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
 Transact-SQL (2000)
 Dynamic SQL - need more than varchar(8000)

Author  Topic 

Delinda
Constraint Violating Yak Guru

315 Posts

Posted - 2009-11-17 : 01:26:25
so far, me using varchar(8000), but still not enough to store dynamic SQL.

i need variable more than varchar(8000), it's possible? me try varchar(max) still not enough

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-11-17 : 01:27:21
You've got a poorly designed system if you need that big of a string for dynamic SQL. Why does it need to be dynamic in the first place?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

Delinda
Constraint Violating Yak Guru

315 Posts

Posted - 2009-11-17 : 01:29:08
quote:
Originally posted by tkizer

You've got a poorly designed system if you need that big of a string for dynamic SQL. Why does it need to be dynamic in the first place?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."



because my table partition into year and month - tTrip_200910, tTrip_200909, and so on

any solution?
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-11-17 : 01:31:09
It sounds like you are partitioning manually via multiple tables rather than what SQL Server provides through table partitioning. Have you looked into table partitioning instead, which would just have one base table and many partitions?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

Delinda
Constraint Violating Yak Guru

315 Posts

Posted - 2009-11-17 : 03:23:19
quote:
Originally posted by tkizer

It sounds like you are partitioning manually via multiple tables rather than what SQL Server provides through table partitioning. Have you looked into table partitioning instead, which would just have one base table and many partitions?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."



Me will looking into Table partitioning. This technology support SQL Server 2000?
Go to Top of Page

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2009-11-17 : 09:11:21
have to do it manually. may want to create a view

Create View tTrip_ALL
AS
SELECT fields FROM tTrip_200909
union all
SELECT fields FROM tTrip_200908
etc.
Go to Top of Page

lhull_sql
Starting Member

1 Post

Posted - 2009-11-18 : 12:04:02
Tara-can you explain why you think it is poorly designed if you need a large dynamic SQL string? We have same problem as one listed above and use many dynamic SQL stored procedures that allow us to have extreme flexibility regarding the parameters passed in and various ways one code base can run because it is dynamic.



quote:
Originally posted by tkizer

You've got a poorly designed system if you need that big of a string for dynamic SQL. Why does it need to be dynamic in the first place?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."

Go to Top of Page

Transact Charlie
Master Smack Fu Yak Hacker

3451 Posts

Posted - 2009-11-18 : 12:08:50
quote:
Originally posted by lhull_sql

Tara-can you explain why you think it is poorly designed if you need a large dynamic SQL string? We have same problem as one listed above and use many dynamic SQL stored procedures that allow us to have extreme flexibility regarding the parameters passed in and various ways one code base can run because it is dynamic.



quote:
Originally posted by tkizer

You've got a poorly designed system if you need that big of a string for dynamic SQL. Why does it need to be dynamic in the first place?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."





Start reading here:
http://www.sommarskog.se/dynamic_sql.html



Charlie
===============================================================
Msg 3903, Level 16, State 1, Line 1736
The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION
Go to Top of Page
   

- Advertisement -