| Author |
Topic |
|
ravilobo
Master Smack Fu Yak Hacker
1184 Posts |
Posted - 2003-11-25 : 06:00:07
|
| I have the following requirementI have written a script in which i am storing the definition of views in a variable.I need to change some of the content in the view.Some of my views have more than 8000 chars. Since a variable can only store max 8000 chars,How to solve this problem? |
|
|
TimChenAllen
Starting Member
45 Posts |
Posted - 2003-11-25 : 06:15:52
|
quote: Originally posted by ravilobo I have the following requirementI have written a script in which i am storing the definition of views in a variable.I need to change some of the content in the view.Some of my views have more than 8000 chars. Since a variable can only store max 8000 chars,How to solve this problem?
Maybe you can use field of type ntext (UNICODE text, limit of 2^31 characters).--TimothyAllen[url]http://www.timallen.org[/url] |
 |
|
|
ravilobo
Master Smack Fu Yak Hacker
1184 Posts |
Posted - 2003-11-25 : 06:38:33
|
| No i can't use text datatype for a local variable, for e.g.declare @bigText texti am getting the error.Net SqlClient Data Provider: Msg 2739, Level 16, State 1, Line 1The text, ntext, and image data types are invalid for local variables. |
 |
|
|
ehorn
Master Smack Fu Yak Hacker
1632 Posts |
Posted - 2003-11-25 : 07:16:05
|
One option might be to parse it into many variables such as :declare @SELECT varchar(8000), @FROM varchar(8000), @WHERE varchar(8000) @ORDERBY varchar(8000) or something like that.. |
 |
|
|
nathan_d_s
Starting Member
4 Posts |
Posted - 2003-11-25 : 07:24:06
|
| Use more than one variable.Declare @var1 varchar(8000),@var2 varchar(8000)Save first 8000 character in @var1 and the rest in @var2. |
 |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2003-11-25 : 08:45:33
|
| also you can make your life easier in your Views by usuing Alias's if you are repeating large table names over and over throughout.(In case you're wondering what this has to do with anything, it'll make your views much shorter and easier to read. especialyl if the "query designer" in Enterprise manager is how you are creating views)- Jeff |
 |
|
|
ravilobo
Master Smack Fu Yak Hacker
1184 Posts |
Posted - 2003-11-26 : 09:19:51
|
| I can't create more than 1 variables. How many variables should i create 2,3,4?Isn't there a simple way?I think, therefore I am |
 |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2003-11-26 : 09:36:45
|
| Why are you dynamically changing these view definitions within SQL? What about your database makes this is necessary requirement?If it is installation or occasional upgrading/patching, why not use VB and SQLDMO to do this?- Jeff |
 |
|
|
|