July 14, 2005 at 8:36 am
Well, my SA's tell me we're on SP3a. Then again, they're not the brightest bulbs in the bunch.
Besides, Noeld, this is from the cursor to dynamic SQL conversion thread you helped with a couple of days ago, remember? You even warned me to watch out for string lengths...
July 14, 2005 at 8:40 am
Prove him wrong .
Select @@version
what's the compatibility level?
July 14, 2005 at 8:49 am
Microsoft SQL Server 2000 - 8.00.818 (Intel X86) May 31 2003 16:08:15 Copyright (c) 1988-2003 Microsoft Corporation Enterprise Edition on Windows NT 5.2 (Build 3790: )
July 14, 2005 at 9:13 am
SP3a is 8.00.760 you're late .
July 14, 2005 at 9:36 am
This is the site that Bkelly use to check version number and SP/Hotfix Levels
Looks handy to keep around
* Noel
July 14, 2005 at 2:44 pm
Actually Remi,
There were 70 tables that qualified for the query, and the total bytes was about 7200. None of which helps to explain why The variable is being limited to 4000 bytes.
July 14, 2005 at 2:53 pm
Bingo :
SELECT dbo.sysobjects.name AS TableName, dbo.syscolumns.name AS ColName, dbo.systypes.name AS DateType, dbo.systypes.xtype
FROM dbo.systypes INNER JOIN
dbo.syscolumns ON dbo.systypes.xtype = dbo.syscolumns.xtype INNER JOIN
dbo.sysobjects ON dbo.syscolumns.id = dbo.sysobjects.id
WHERE (dbo.sysobjects.id = 1) AND (dbo.syscolumns.name = N'name')
sysobjectsnamenvarchar231
sysobjectsnamesysname231
The name column of SysObjects is SysName (NVarchar)
Declare @sql as varchar(8000)
select @sql = ''
-- select len(@SQL)
-- select datalength(@SQL)
select @sql = @sql + 'Create View vw_' + CAST(name as varchar(128)) + char(10) +
'AS' + char(10) +
'select * ' + char(10) +
'from dbo.' + CAST(name as varchar(128)) + char(10)
from dbo.sysobjects
where xtype = 'U'
order by name
print @sql
print len(@SQL)
--8000
July 15, 2005 at 8:05 am
Thanks Remi, that works. Has sysname always been an Nvarchar datatype? I don't remember running into this problem before and I have been doing this for a number of years now.
July 15, 2005 at 8:11 am
It is on my machine. Maybe it has something to do with the default collation of the server (but wouldn't make sens in my case). I think that the most likely explaination is that it's the first time you go over 4000K characthers when you do that.
July 15, 2005 at 11:21 am
>> Has sysname always been an Nvarchar datatype? <<
YES it always have been nvarchar(128). SQL Server 7 and up are designed to support unicode named objects
Cheers!
* Noel
July 15, 2005 at 7:25 pm
Thanx for the confirmation.. i'll try to remember that next time I encounter this .
Viewing 11 posts - 16 through 25 (of 25 total)
You must be logged in to reply to this topic. Login to reply