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 2005 Forums
 Transact-SQL (2005)
 Redefine SQL Variable?

Author  Topic 

Planet_x
Starting Member

15 Posts

Posted - 2010-05-03 : 16:06:25
I am trying to set an SQL variable (varchar) to be equal to the length of a string being read from a cursor. Is there anyway to redim the variable like VB to the length of the string like
declare @first_string varchar(mylength) .. this is not working. Any suggestion appreciated.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-05-03 : 16:09:45
That isn't possible in SQL Server. Set the size to the maximum expected size for the string to avoid truncation.

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

Subscribe to my blog
Go to Top of Page

Planet_x
Starting Member

15 Posts

Posted - 2010-05-03 : 16:32:29
Ok thanks for the response, I figured out how to do what I needed using a different method.
Go to Top of Page
   

- Advertisement -