dbTalk Databases Forums  

large scripted stored procedure

comp.databases.ms-sqlserver comp.databases.ms-sqlserver


Discuss large scripted stored procedure in the comp.databases.ms-sqlserver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
avcitamer
 
Posts: n/a

Default large scripted stored procedure - 05-17-2011 , 09:30 AM






hi,
I need to compile stored procedures and functions larger than
8000bytes on Sql Server 2005.
I even tried CLR procedure, but unfortunately it didnt work.
what can I do. Please help me.
thanks

Reply With Quote
  #2  
Old   
Erland Sommarskog
 
Posts: n/a

Default Re: large scripted stored procedure - 05-17-2011 , 04:07 PM






avcitamer (ttavci (AT) gmail (DOT) com) writes:
Quote:
I need to compile stored procedures and functions larger than
8000bytes on Sql Server 2005.
I even tried CLR procedure, but unfortunately it didnt work.
what can I do. Please help me.
Not sure that I understand where the problem is. In the system I work
with, there is a stored procedure which is 3806 lines long, and some
160.000 bytes in size.

Could you describe your problem in more detail?

--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx

Reply With Quote
  #3  
Old   
Gene Wirchenko
 
Posts: n/a

Default Re: large scripted stored procedure - 05-17-2011 , 05:15 PM



On Tue, 17 May 2011 23:07:49 +0200, Erland Sommarskog
<esquel (AT) sommarskog (DOT) se> wrote:

Quote:
avcitamer (ttavci (AT) gmail (DOT) com) writes:
I need to compile stored procedures and functions larger than
8000bytes on Sql Server 2005.
I even tried CLR procedure, but unfortunately it didnt work.
what can I do. Please help me.

Not sure that I understand where the problem is. In the system I work
with, there is a stored procedure which is 3806 lines long, and some
160.000 bytes in size.

Could you describe your problem in more detail?
I suspect that he is storing code in a database. Does SS 2005
have varchar(max)?

Sincerely,

Gene Wirchenko

Reply With Quote
  #4  
Old   
avcitamer
 
Posts: n/a

Default Re: large scripted stored procedure - 05-18-2011 , 01:20 AM



On 18 Mayıs, 00:07, Erland Sommarskog <esq... (AT) sommarskog (DOT) se> wrote:
Quote:
avcitamer (tta... (AT) gmail (DOT) com) writes:
I need to compile stored procedures and functions larger than
8000bytes on Sql Server 2005.
I even tried CLR procedure, but unfortunately it didnt work.
what can I do. Please help me.

Not sure that I understand where the problem is. In the system I work
with, there is a stored procedure which is 3806 lines long, and some
160.000 bytes in size.

Could you describe your problem in more detail?

--
Erland Sommarskog, SQL Server MVP, esq... (AT) sommarskog (DOT) se

Links for SQL Server Books Online:
SQL 2008:http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005:http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
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

Reply With Quote
  #5  
Old   
Erland Sommarskog
 
Posts: n/a

Default Re: large scripted stored procedure - 05-18-2011 , 02:32 AM



avcitamer (ttavci (AT) gmail (DOT) com) writes:
Quote:
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 (AT) sommarskog (DOT) se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx

Reply With Quote
  #6  
Old   
avcitamer
 
Posts: n/a

Default Re: large scripted stored procedure - 05-18-2011 , 06:59 AM



On 18 Mayıs, 10:32, Erland Sommarskog <esq... (AT) sommarskog (DOT) se> wrote:
Quote:
avcitamer (tta... (AT) gmail (DOT) 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, esq... (AT) sommarskog (DOT) se

Books Online for SQL Server 2005 athttp://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books...
Books Online for SQL Server 2000 athttp://www.microsoft.com/sql/prodinfo/previousversions/books.mspx- Alıntıyı gizle -

- Alıntıyı göster -
varchar(max) has worked.
you saved my brain being burned.
thaks a lot ...

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.