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)
 Updating a dynamic table

Author  Topic 

Amethystium
Aged Yak Warrior

701 Posts

Posted - 2005-01-13 : 09:36:05
Greetings!

Apologies for the confusing title but I will try and explain my situation as best I can.

I have a table generated by my modified version of the cross-tab query (taken from this website, cheers! )

What I need to do is update the columns in my cross-tab table but since the table will have varying number of columns, I need to do the update using dynamic sql.

Any comments before I go ahead with this approach as I have another idea to solve the problem (using VB) but I thought that it might be better to do the update on the table first.

Thanks in advance.


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

X002548
Not Just a Number

15586 Posts

Posted - 2005-01-13 : 09:39:12
Why can't you incorporate the "update" in the initial build of the crosstab?


Brett

8-)
Go to Top of Page

Amethystium
Aged Yak Warrior

701 Posts

Posted - 2005-01-13 : 10:20:09
quote:
Originally posted by X002548

Why can't you incorporate the "update" in the initial build of the crosstab?



I did think of this initially but I wasn't able to achieve the desired result.


------------->>> BREAKING NEWS!!! <<<-------------
Saddam Hussien has weapons of mass destrcution
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2005-01-13 : 11:10:22
Well that must be some query then...

Well...with dynamic sql, you'd still would have to log/store the metadata abouth the reult set, and have some business logic on how to use it...

But why not post what you have already?



Brett

8-)
Go to Top of Page

Amethystium
Aged Yak Warrior

701 Posts

Posted - 2005-01-13 : 12:56:40
quote:
Originally posted by X002548

Well that must be some query then...

Well...with dynamic sql, you'd still would have to log/store the metadata abouth the reult set, and have some business logic on how to use it...

But why not post what you have already?



Brett

8-)



Yea, I realised that it would be some query to implement so luckily after some thought I came up with the solution. The main problem was the limit of the @select variable which restricts the size to 8000 characters. I was using quite long descriptions for the titles which was causing the sproc to generate very long strings (longer than 8000 charcters). As you know, the crossTab sproc uses the same column headings as the contents of the column so using a couple of cleverly placed REPLACE statments I managed to solve the problem. I am at home right now so I am unable to post the code. Will do tomorrow.

Thanks for your time.


------------->>> BREAKING NEWS!!! <<<-------------
Saddam Hussien has weapons of mass destrcution
Go to Top of Page
   

- Advertisement -