Solved

varchar variable getting truncated to 256 chars!

Posted on 2002-07-08
6
544 Views
Last Modified: 2008-07-03
DECLARE @sql varchar(2000)

this is a delcaration of a variable in sql server procedure. along with some query some more values are getting added to this variable through a loop. But this is getting truncated to 256 chars [and not generating any errors]
Any one knows why it is getting truncated?
0
Comment
Question by:sanjaykattimani
  • 4
  • 2
6 Comments
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 100 total points
ID: 7137460
2 things:
* do you mean that the output in Query Analyser get's truncated?
-> see in the options of query analyser, you have an parameter saying max caracters per column, which is 256 by default. You could increase this value to see more...

* is the compatibility of the database eventually set to version 6?
->  for checking: exec sp_dbcmptlevel 'dbname'
->  for changing: exec sp_dbcmptlevel 'dbname', 7 (or 8 if you have sql 2000)

CHeers



0
 
LVL 3

Author Comment

by:sanjaykattimani
ID: 7137469
* do you mean that the output in Query Analyser get's truncated?

No its being executed inside the procedure and the variable is also declared inside sql procedure.

* is the compatibility of the database eventually set to version 6?
compatibility version is set to 7 [default]

Any more info..?

0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 7137474
Then the problem is probably the code, can you post it (at least those parts that are relevant to assigning the values to the variable).

* do you mean that the output in Query Analyser get's truncated?
> No its being executed inside the procedure and the variable is also declared inside sql procedure.
Ok, but where do you SEE that the value is truncted to 256?

CHeers
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
LVL 3

Author Comment

by:sanjaykattimani
ID: 7137486
:) thanks for instant replies.

Hey its solved. Thanks.
Yes it was query analyser, result was dumped in a table and was being viewed by query analyser.

Thanks again
0
 
LVL 3

Author Comment

by:sanjaykattimani
ID: 7137530
i am getting
Expected ';' in line 1
error in every page. Kindly solve it.

Also i didnt receive any satisfactory answer to my question
http://www.experts-exchange.com/visualbasic/Q_20317813.html
what to do.. delete this... or still i can expect some answer?

0
 
LVL 3

Author Comment

by:sanjaykattimani
ID: 7137531
sorry.... above comment in a wrong place..
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now