Link to home
Start Free TrialLog in
Avatar of Paul__M
Paul__M

asked on

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.
ASKER CERTIFIED SOLUTION
Avatar of Lowfatspread
Lowfatspread
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Paul__M
Paul__M

ASKER

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.