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 |
|
TAS
Yak Posting Veteran
65 Posts |
Posted - 2005-07-14 : 13:34:19
|
| I have a store procedure below:Alter Procedure ProcTableNote@Table varchar(100),@Note varchar(1000)AsSet nocount onBegin Declare @SQL varchar(1000) Select @SQL = 'Insert into ' + @Table +'' Select @SQL = @SQL + ' Values(' + @Note + ')' Exec (@SQL)End When I run it:ProcTableNote 'NewEngland','test.'It comes an error message:Server: Msg 170, Level 15, State 1, Line 1Line 1: Incorrect syntax near ')'.What's wrong with the code? |
|
|
Kristen
Test
22859 Posts |
Posted - 2005-07-14 : 13:39:22
|
| "test" will have no quotes around it when the string handling is done.PutPRINT @SQLinstead of Exec (@SQL)and you'll be able to debug it.However, I gotta ask. What's the point of this Sproc? (Assuming this isn't just a simplified snippet you've posted here)Kristen |
 |
|
|
|
|
|