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
 General SQL Server Forums
 New to SQL Server Programming
 Character len probelm with executesql

Author  Topic 

sanjnep
Posting Yak Master

191 Posts

Posted - 2007-06-15 : 15:26:53
I need to create some tables dynamically using sp_executesql. But the problem is the length of sql string is more the 4000 characters. How can I solve this problem?
Thanks

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-06-15 : 15:34:52
Create table in 4000 characters then alter it with another 4000 characters.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2007-06-15 : 15:42:20
Or how about redesigning your schema so that you don't have tables with this many characters in it? Is your database properly normalized? Why do you need to create tables dynamically?

Tara Kizer
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-06-16 : 00:50:43
quote:
Originally posted by sanjnep

I need to create some tables dynamically using sp_executesql. But the problem is the length of sql string is more the 4000 characters. How can I solve this problem?
Thanks



You should avoid creating tables dynamically
Otherwise you will end up with too much dynamic SQL

Also you should use Dynamic SQL only if you want to pass object names as parameters
www.sommarskog.se/dynamic_sql.html

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -