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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Dynamic SQL not working

Author  Topic 

victory_vishnu
Starting Member

8 Posts

Posted - 2008-05-08 : 04:27:48
Hi All

I tried to convert a SP into Dynamic SQL ...
After i tried to build a SQL String (in @SSQL) i tried to execute this but it gives me a message :Syntax error converting the varchar value '

I then tried to find out the length of the @SSQL string that i built ...and its was only 256 char its not accepting more than 256 chars .

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-05-08 : 04:58:32
what does this return?

print @SSQL

Also you should post the question at relevent forum

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-05-08 : 05:02:04
DECLARE @SSQL VARCHAR(8000)

or

DECLARE @SSQL NVARCHAR(4000)

of if using SQL Server 2005

DECLARE @SSQL VARCHAR(MAX)
or
DECLARE @SSQL NVARCHAR(MAX)



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2008-05-08 : 05:12:29
moved from script library.

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
SSMS Add-in that does a few things: www.ssmstoolspack.com <- version 1.0 out!
Go to Top of Page
   

- Advertisement -