- Jun 14, 2006
- 114
- 0
- 0
Hi,
SQL Question.
I have a stored procedure that is called by DCOM. The COM sends over @String and I need to chop the string up into two variables and then update a table. The value of @cde can be 1,23, 143 and so on but I need to pad it with zero's if its ever one or two digits long before updating the table. Based on what i'm doing below, can someone tell me how to pad zero's to @cde before the update?
set @cr_tax = ltrim(rtrim(substring(@String, 1 , patindex("%`~%", @String)-1)))
set @String = Case When patindex("%`~%", @String)>0 Then substring(@String, 2 + patindex("%`~%", @String), 2000) Else '' End
set @cde = ltrim(rtrim(substring(@String, 1 , patindex("%`~%", @String)-1)))
set @String = Case When patindex("%`~%", @String)>0 Then substring(@String, 2 + patindex("%`~%", @String), 2000) Else '' End
Update table1 set cr_tax = @cr_tax and cde = @cde
Thanks!
SQL Question.
I have a stored procedure that is called by DCOM. The COM sends over @String and I need to chop the string up into two variables and then update a table. The value of @cde can be 1,23, 143 and so on but I need to pad it with zero's if its ever one or two digits long before updating the table. Based on what i'm doing below, can someone tell me how to pad zero's to @cde before the update?
set @cr_tax = ltrim(rtrim(substring(@String, 1 , patindex("%`~%", @String)-1)))
set @String = Case When patindex("%`~%", @String)>0 Then substring(@String, 2 + patindex("%`~%", @String), 2000) Else '' End
set @cde = ltrim(rtrim(substring(@String, 1 , patindex("%`~%", @String)-1)))
set @String = Case When patindex("%`~%", @String)>0 Then substring(@String, 2 + patindex("%`~%", @String), 2000) Else '' End
Update table1 set cr_tax = @cr_tax and cde = @cde
Thanks!