Please start any new threads on our new site at http://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 inserting salary in form of *
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

pawii
Starting Member

India
1 Posts

Posted - 02/08/2013 :  10:39:26  Show Profile  Reply with Quote
i want to project the salary of an employee in the form of *
if a salary of an employee is 20 thousand then there should be 20 * in the salary column

ssss

James K
Flowing Fount of Yak Knowledge

3873 Posts

Posted - 02/08/2013 :  10:58:27  Show Profile  Reply with Quote
You will need a varchar column to hold this data - you cannot store it in a numeric column. So it would be something like this:
-- first add the salary indicator column.
ALTER TABLE YourTable ADD SalaryIndicator VARCHAR(32);

-- now populate the column. You could even make this a computed column
UPDATE YourTable SET SalaryIndicator
	= CAST(ROUND(Salary,-3)/1000 AS VARCHAR(32)) + ' *';

Edited by - James K on 02/08/2013 11:06:31
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000