Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.databases.ms-sqlserver    |    Notorious Rube Goldberg contraption    |    19,505 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 18,326 of 19,505    |
|    Erland Sommarskog to avcitamer    |
|    Re: large scripted stored procedure    |
|    18 May 11 07:32:51    |
      35040024       From: esquel@sommarskog.se              avcitamer (ttavci@gmail.com) writes:       > In my project, I compile stored procedures dynamically as shown       > below...       >       > declare @sql01 varchar(max) set @sql01='create procedure dbo.foo() as       > begin bla bla bla......' --8000 bytes long...       > declare @sql02 varchar(max) set @sql02='bla bla bla......bla bla' --       > 8000 bytes long...       > declare @sql03 varchar(max) set @sql03='bla bla bla...... end' -- 8000       > bytes long...       > exec (@sql01+ @sql02+@sql03)       >       > but sql server sees only first 8000 bytes of script and gives       > error....       > this situation occurs during dynamic creation...(not at query       > analyzer)       > thanks              Since varchar(MAX) can fit up to 2GB of data, why mess with many variables?              But apart from that, the scheme as presented should work. Obviously, you are       doing something wrong, but since I don't see your actual code, I can say       what it is.              How do you conclude that SQL Server only sees the first 8000 bytes? You are       not looking at SELECT @sql01 + @sql02 + ... in Mgmt Studio, are you? SSMS       will only show you the first 8000 characters.                     --       Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se              Books Online for SQL Server 2005 at       http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx       Books Online for SQL Server 2000 at       http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx              --- SoupGate-Win32 v1.05        * Origin: you cannot sedate... all the things you hate (1:229/2)    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca