May 21, 2007 at 8:57 am
Hi,
In a table I store some SQL Statements that need to be run.
The Table is very simple :
CREATE TABLE MyTab (
UID AS UNIQUEIDENTIFIER,
REQ AS TEXT,
ORD AS int
)
To execute, I'm using a SP that :
-1- Create a cursor with a simple select in the table,
-2- REQ is stored in a varchar(8000) (limited by program),
-3- EXECUTE(REQ)
I've read some articles (here) and it seems that using sp_executesql is better.
When I read the doc, it seems that sp_executesql accepts TEXT parameters. If I was able to directly use TEXT variable, I will be able to delete the limitation to 8000.
Problems : I cannot declare TEXT variables on a PS...
Any ideas ?
==> Can I use a BINARY(16) and execute it ?
May 21, 2007 at 9:47 am
You are right about declaring a local variable inside the SP, however, you can declare it as an INPUT parameter and never pass a value, in other words, pass a NULL and then use it inside the SP.
Also, if you are sure, your statements are not larger than 8000 chars, then stick to vachar(8000) and select the substring(REQ,1,8000) instead.
May 21, 2007 at 9:50 am
In some case, it cab be bigger ... so i have to split ...
Stick to 8000 is better ?
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply