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 2000 Forums
 SQL Server Development (2000)
 dynmic sql question

Author  Topic 

PeterG
Posting Yak Master

156 Posts

Posted - 2002-05-13 : 15:44:13
This is my code:
 
set @profID = 1
declare @allowall bit
declare @text varchar(25)
set @text = ''
Set @sql = 'SELECT E2.txtCostCenter, E2.txtDescription FROM CodeDpndCol2 CD
INNER JOIN Element' + @acctLevel + '_Codes E1 ON CD.lngCodeDependID = E1.lngIndex
INNER JOIN Element2_Codes E2 INNER JOIN CodePfMulti2 CP ON E2.lngIndex = CP.lngCodeID
ON CD.lngCodeSourceID = E2.lngIndex WHERE (E1.txtCostCenter = N''' + @array_value + ''')
AND (CP.lngProfID = ' + @profID + ') AND ((E2.txtCostCenter like N''' + @text + '%' + ''')
OR (E2.txtDescription Like N''' + @text + '%' + '''))'
--exec ( @sql )
select @sql



This is what I get when I do a select @sql on this query in query analyzer I only get a partial sql statement. Why?

"SELECT E2.txtCostCenter, E2.txtDescription FROM CodeDpndCol2 CD
INNER JOIN Element1_Codes E1 ON CD.lngCodeDependID = E1.lngIndex
INNER JOIN Element2_Codes E2 INNER JOIN CodePfMulti2 CP ON E2.lngIndex = CP.lngCodeID
ON CD.lngCodeSourceID = E2.lngIndex WH

( row(s) affected)"



PeterG
Posting Yak Master

156 Posts

Posted - 2002-05-13 : 15:52:59
Pls ignore this post. I found my error. A dumb mistake really!

Go to Top of Page

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2002-05-13 : 15:53:12
cause your max character per column for the current session is set to 256 . . .

<O>
Go to Top of Page
   

- Advertisement -