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.
Author |
Topic |
sebastian11c
Posting Yak Master
129 Posts |
Posted - 2012-04-30 : 13:30:58
|
hi there i have a tablecalled "products"product codeapple 23grape 7etc i need to add to all my codes, zeros at the beggining untill complete a lenght=6thats the table that i neeedproduct codeapple 000023grape 000007thanks for your helpmany many thanks |
|
yosiasz
Master Smack Fu Yak Hacker
1635 Posts |
Posted - 2012-04-30 : 13:59:27
|
what datatype is that column?will the final length of that field always be 6?<><><><><><><><><><><><><><><><><>If you don't have the passion to help people, you have no passion |
 |
|
DonAtWork
Master Smack Fu Yak Hacker
2167 Posts |
Posted - 2012-04-30 : 13:59:54
|
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=162392&SearchTerms=pad,leftHow to ask: http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspxFor ultra basic questions, follow these links.http://www.sql-tutorial.net/ http://www.firstsql.com/tutor.htm http://www.w3schools.com/sql/default.asp |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-04-30 : 14:26:21
|
RIGHT('000000' + cast(code as varchar(6)),6)------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
sebastian11c
Posting Yak Master
129 Posts |
Posted - 2012-04-30 : 16:57:50
|
thanks a lot for everyone |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-05-01 : 10:10:55
|
wc------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|