• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 309
  • Last Modified:

Stored Procedure: Truncation of a nvarchar when being added to

A quick SQL Server 8.0 question

I have the following test stored procedure :

CREATE PROCEDURE  sp_testproc
AS
declare @varSQL   nvarchar(1000)
    SET @varSQL = 'SELECT BranchSortCode, BranchName, Address1, Address2, Address3, Address4, Pcode FROM BranchFile WHERE 1=1'
    SET @varSQL = @varSQL + ' ORDER BY BranchSortCode'
    EXECUTE(@varSQL)
GO

in debug when stopped at execute line

@varSQL = N'SELECT BranchSortCode, BranchName, Address1, Address2, Address3, Address4, Pcode FROM BranchFile WHERE 1=1 ORDER BY BranchSortC'

and has a type of nvarchar(130)


Why is the variable varSQL being truncated when its size is 1000 ????

Thanks.
0
Paul__M
Asked:
Paul__M
1 Solution
 
LowfatspreadCommented:
are you confusing the display amount with the actual length of the contents....

what does a Length(@varsql) and a datalength(@varsql)

show
0
 
Paul__MAuthor Commented:
having looked again - 130 is the actual length of the string but why does the debug window truncate the variable contents - I'm actually trying to debug a more complex string build and with the truncation cannot see the SQL statement I'm trying to execute.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now