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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2006-10-17 : 07:53:53
|
| Sal writes "If I need to develope a string in a stored procedure which must be used in the Exec command and the string needs to have single quotes in it, how can it be done. I've tried two single quotes together, I've tried double quotes , etc.Simple example. This example does not work in VS2005Declare @Str as varchar(1000)set @str = 'insert into test (LogDate) values ('10/06/2006')'exec(@str)I can't get the single quotes around the date field to appear in the @str variableI am using VS2005 and SQL2000Is there a setting I am missing or anything else.Also can stored procedures use integer arrays. I've tried a few way to declare them, but it does not seem to work.Sal" |
|
|
Antonio
Posting Yak Master
168 Posts |
Posted - 2006-10-17 : 08:14:12
|
quote: Originally posted by AskSQLTeam Sal writes "If I need to develope a string in a stored procedure which must be used in the Exec command and the string needs to have single quotes in it, how can it be done. I've tried two single quotes together, I've tried double quotes , etc.Simple example. This example does not work in VS2005Declare @Str as varchar(1000)set @str = 'insert into test (LogDate) values ('10/06/2006')'exec(@str)I can't get the single quotes around the date field to appear in the @str variableI am using VS2005 and SQL2000Is there a setting I am missing or anything else.
Please refer to SET QUOTED_IDENTIFIER in BOL for further information.quote: Also can stored procedures use integer arrays. I've tried a few way to declare them, but it does not seem to work.Sal"
You can you create a function and pass a table variable as input parameter._________________________________________________________________________________________________________________________Inability is a disaster; patience is bravery; abstinence is a treasure, self-restraint is a shield; and the best companion is submission to Divine Will. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|
|