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

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 inserting salary in form of *

Author  Topic 

pawii
Starting Member

1 Post

Posted - 2013-02-08 : 10:39:26
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
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2013-02-08 : 10:58:27
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)) + ' *';
Go to Top of Page
   

- Advertisement -