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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VARCHAR(8000) Truncation Issue

Status
Not open for further replies.

talenx

Programmer
Aug 7, 2001
157
US
Hi all,
this is VERY werid, I wrote a sp that has a simple dynamic string builder in it..
that is later exec()
the odd thing here is when i attempt to build the SQL string it only returns 307 chars from a varchar(8000) varible.

here is the code ( i have stripped out the dyn varibles for ease of exec.)

Code:
SET NOCOUNT ON
SET ANSI_WARNINGS OFF
DECLARE @SQL varchar(8000)

SET @SQL = 
'CREATE TABLE dbo.tPRODUCTSALES_200001 (
[PKID] [int] IDENTITY (1, 1) NOT NULL ,
[MONTH_ID] [int] NOT NULL ,
CONSTRAINT chk_MONTH_IDCHECK200001 (MONTH_ID = 200001 ),
[PRODUCT_ID] [int] NULL ,
[SALES] [decimal](7, 2) NULL ,
[QTY] [numeric](9, 0) NULL ,
[ENTRYDATE] [datetime] NULL ) ON [PRIMARY]GO'

SELECT LEN(@SQL) as Char_Len_Value
SELECT (@SQL) as SQL_String

RESULTS: ( notice that the SQL string stops after the OTY columns ","
-----------------------------------------------
Char_Len_Value
--------------
302

SQL_String
-------------------------------------------------
CREATE TABLE dbo.tPRODUCTSALES_200001 (
[PKID] [int] IDENTITY (1, 1) NOT NULL ,
[MONTH_ID] [int] NOT NULL ,
CONSTRAINT chk_MONTH_IDCHECK200001 (MONTH_ID = 200001 ),
[PRODUCT_ID] [int] NULL ,
[SALES] [decimal](7, 2) NULL ,
[QTY] [numeric](9, 0) NULL ,


here is the rest of the string that should be inthe result set but isn't.
[ENTRYDATE] [datetime] NULL ) ON [PRIMARY]GO'




Any Thoughts
Thanks
TalenX
 
Tools -> Options -> Maximum characters per column is set to 256?

------
"There's a man... He's bald and wears a short-sleeved shirt, and somehow he's very important to me. I think his name is Homer."
(Jack O'Neill, Stargate)
[banghead]
 
Are you running this in query analyzer. if so, go to Tools --> Options. Click on the Results tab. Change the value in the Maximum Characters per Column textbox to 8000


Jim
 
LOL!!!
vongrunt,jbenson001
That was tooo easy... sorry I'm being an idiot today.

Thanks alot

TalenX
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top