Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 CrossTab query question

Author  Topic 

Amethystium
Aged Yak Warrior

701 Posts

Posted - 2005-02-10 : 11:08:35
Greetings!

I've been using the cross-tab quite a bit lately and have adapted it to suit my needs but now I am running in to an interesting problem. The variable which holds the final SQL statement is not long enough, i.e. my generated SQL statement is longer than 8000 characters. Have you guys been able to cope with this so that it deals with longer queries?!

Just thought I'd ask before I attempt to modify the sproc yet again.

Thanks in advance.


------------->>> BREAKING NEWS!!! <<<-------------
Saddam Hussien has weapons of mass destrcution

rockmoose
SQL Natt Alfen

3279 Posts

Posted - 2005-02-10 : 15:22:53
You know the technique exec(@sql_prt1+@sql_prt2+@sql_prt3).
Also look at this:
create table #sql(sql varchar(8000))
insert #sql
select 'select *'
union all select 'from'
union all select 'northwind..orders'

exec sp_execresultset @cmd = 'select sql from #sql'
drop table #sql

There is a thread on sp_execresultset, but I can't find it.


rockmoose
Go to Top of Page
   

- Advertisement -