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
 Remove the 0 before

Author  Topic 

shanmugaraj
Posting Yak Master

219 Posts

Posted - 2012-01-08 : 16:35:43
Remove the 0 before

HI,
I need the query for below
I have data from flat file and i want to save the code column without 0 before

columns
code nvarchar(7)
name nvarchar(40)

----------
flat file
----------
EmpCode name
003 Raj
048 Kumar
073 selvam
100 gopal
140 gomathi
T3R Nayaki
YEU Yasodha
OPE Easwari
063 Rani


I want to insert removing 0 before code column
----------
SQL Insert
----------
EmpCode Name
3 Raj
48 Kumar
73 selvam
100 gopal
140 gomathi
T3R Nayaki
YEU Yasodha
OPE Easwari
63 Rani

Kindly help me with query
I tried below and not working :(
LTRIM(EmpCode,'0');
(CAST (CAST EmpCode AS int) AS varchar(7))



THANKS
SHANMUGARAJ
nshanmugaraj@gmail.com

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2012-01-08 : 16:52:52
Duplicate post. No replies to this thread please. Direct replies to:[url]http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=169940[/url]

--
Gail Shaw
SQL Server MVP
Go to Top of Page
   

- Advertisement -