hi,
I have this command in Vb that feeds "0" in a string, and I need it to work in a SP.
ProductNum = format(ProductNum, String(nBarCodelength, "0"))
if ProductNum = "12345" and nBarCodelength = 10
the result of the above will be "0000012345" (the numbers were fed with "0").
placing that command in a SP raises me an error.
What replaces 'format' and 'String' commands in TSQL?
ThanksTry:
declare @.string varchar(20)
select @.string = '12345'
select stuff(@.string,1,0,replicate('0',10 - len(@.string)))
or
declare @.string varchar(20)
select @.string = '12345'
select replicate('0',10 - len(@.string)) + @.string|||Originally posted by rnealejr
Try:
declare @.string varchar(20)
select @.string = '12345'
select stuff(@.string,1,0,replicate('0',10 - len(@.string)))
or
declare @.string varchar(20)
select @.string = '12345'
select replicate('0',10 - len(@.string)) + @.string
I will try it.
Many thanks mate.....
Showing posts with label command. Show all posts
Showing posts with label command. Show all posts
Monday, March 26, 2012
Feeding "0"s in a string
Friday, February 24, 2012
failure to install SQL Agent for SQL Express
I just tried to install the file:
D:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe SQLAgent.exe by running it from a command prompt.
and got an error that the system could not find the file or one of its components. It is a farily new install. I do not think I've lost any files any time.
What is the problem?
Thanks.
SQL Express does not include SQL Agent, you need to purchase at least SQL Server Workgroup to get that component.
Mike
Subscribe to:
Posts (Atom)