|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Dynamic SQL > 4000 Characters IssueHello.
I have a Stored Procedure that has a required argument passed to it. This argument is then used to create dynamic SQL which is then exectued via the EXEC statement. I'm using an nVarChar(4000) since nVarChar has a limitation of 4000. However, my SP has > 4000 characters. What can I do to overcome this? I thought about using @SQL1 and @SQL2 but wasn't sure how to execute this. Exec (@SQL1) + (@SQL2)? Any suggestion will ge greatly appreciated :-). Thanks, Rita In SQL 2000,
EXEC (@SQL1 + @SQL); HTH Vern Rabe Show quote "RitaG" wrote: > Hello. > > I have a Stored Procedure that has a required argument passed to it. This > argument is then used to create dynamic SQL which is then exectued via the > EXEC > statement. I'm using an nVarChar(4000) since nVarChar has a limitation of > 4000. > However, my SP has > 4000 characters. > > What can I do to overcome this? > > I thought about using @SQL1 and @SQL2 but wasn't sure how to execute this. > Exec (@SQL1) + (@SQL2)? > > Any suggestion will ge greatly appreciated :-). > > Thanks, > Rita Hi Vern.
I landed up using the VarChar(8000) which worked for me. Thanks for your response. Rita Show quote "Vern Rabe" wrote: > In SQL 2000, > > EXEC (@SQL1 + @SQL); > > HTH > Vern Rabe > > "RitaG" wrote: > > > Hello. > > > > I have a Stored Procedure that has a required argument passed to it. This > > argument is then used to create dynamic SQL which is then exectued via the > > EXEC > > statement. I'm using an nVarChar(4000) since nVarChar has a limitation of > > 4000. > > However, my SP has > 4000 characters. > > > > What can I do to overcome this? > > > > I thought about using @SQL1 and @SQL2 but wasn't sure how to execute this. > > Exec (@SQL1) + (@SQL2)? > > > > Any suggestion will ge greatly appreciated :-). > > > > Thanks, > > Rita Hi Rita
Do you need the unicode cahr set ? if not use the varchar type which has a 8000 limir HTH -- Show quoteRegards Reg Besseling "RitaG" wrote: > Hello. > > I have a Stored Procedure that has a required argument passed to it. This > argument is then used to create dynamic SQL which is then exectued via the > EXEC > statement. I'm using an nVarChar(4000) since nVarChar has a limitation of > 4000. > However, my SP has > 4000 characters. > > What can I do to overcome this? > > I thought about using @SQL1 and @SQL2 but wasn't sure how to execute this. > Exec (@SQL1) + (@SQL2)? > > Any suggestion will ge greatly appreciated :-). > > Thanks, > Rita Thanks Reg. I tried the VarChar(8000) and that worked fine.
For some reason I thought I was restricted to nVarChar. Show quote "Reg Besseling" wrote: > Hi Rita > > Do you need the unicode cahr set ? if not use the varchar type which has a > 8000 limir > > HTH > -- > Regards > > Reg Besseling > > > "RitaG" wrote: > > > Hello. > > > > I have a Stored Procedure that has a required argument passed to it. This > > argument is then used to create dynamic SQL which is then exectued via the > > EXEC > > statement. I'm using an nVarChar(4000) since nVarChar has a limitation of > > 4000. > > However, my SP has > 4000 characters. > > > > What can I do to overcome this? > > > > I thought about using @SQL1 and @SQL2 but wasn't sure how to execute this. > > Exec (@SQL1) + (@SQL2)? > > > > Any suggestion will ge greatly appreciated :-). > > > > Thanks, > > Rita sp_executesql requires NVARCHAR. EXEC by itself can use VARCHAR.
-- Show quote================================ Mike C# Not affiliated with MSFT "RitaG" <Ri***@discussions.microsoft.com> wrote in message news:1F292C51-FBD1-47FD-BE3E-8C6658B2C75A@microsoft.com... > Thanks Reg. I tried the VarChar(8000) and that worked fine. > For some reason I thought I was restricted to nVarChar. > > "Reg Besseling" wrote: > >> Hi Rita >> >> Do you need the unicode cahr set ? if not use the varchar type which has >> a >> 8000 limir >> >> HTH >> -- >> Regards >> >> Reg Besseling >> >> >> "RitaG" wrote: >> >> > Hello. >> > >> > I have a Stored Procedure that has a required argument passed to it. >> > This >> > argument is then used to create dynamic SQL which is then exectued via >> > the >> > EXEC >> > statement. I'm using an nVarChar(4000) since nVarChar has a limitation >> > of >> > 4000. >> > However, my SP has > 4000 characters. >> > >> > What can I do to overcome this? >> > >> > I thought about using @SQL1 and @SQL2 but wasn't sure how to execute >> > this. >> > Exec (@SQL1) + (@SQL2)? >> > >> > Any suggestion will ge greatly appreciated :-). >> > >> > Thanks, >> > Rita |
|||||||||||||||||||||||