SQL Server Forums
Profile | Register | 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 *
 New Topic  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

3761 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  
 New 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.03 seconds. Powered By: Snitz Forums 2000