Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Count characters in a variable??

Status
Not open for further replies.

katbear

Programmer
Mar 14, 2007
270
US
Hi,

RE: SQL Server 2000

Here is my task. I will be writing the results of query to a datatype of varchar(8000).

However, the results of the query often exceed 8000 characters... so I can't fit the entire result in the variable.

An alternative we were thinking of is to define additional varchar(8000) variables, and store the "overflow" of 8000+ characters in the additional variables.

So, the question is, how to tell when the first variable is approaching the 8000 character limit?

Is there a way to do this???

Thanks much
 
You can use the LEN function to find the length of the variable.

Denny
MCSA (2003) / MCDBA (SQL 2000)
MCTS (SQL 2005 / Microsoft Windows SharePoint Services 3.0: Configuration / Microsoft Office SharePoint Server 2007: Configuration)
MCITP Database Administrator (SQL 2005) / Database Developer (SQL 2005)

--Anything is possible. All it takes is a little research. (Me)
[noevil]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top