Reply to topic
Table Aesthetics / Column Sort Order
cbsinet.com


Joined: 04 Oct 2004
Posts: 18
Location: Dunedin, FL
Reply with quote
I've always used a table creation interface like the one in InterDev, which I liked most, or the one in SQL Server Enterprise Manager. I've recently started creating my tables through the query analyzer because loading the list of databases from the tree in Enterprise Manager takes 30-60min.

I used to be able to insert new columns above other ones in the creation interface. Now, through SQL, I am only able to tack columns onto the end of the list instead of the middle.

How would this usually be done? My first guess is that it made a temporary table with the following columns and dropped the columns being shifted then recreated the table and inserted the data back in.

If there's a simpler method I would love to know. Thanks for your time and help!
cbsinet.com


Joined: 04 Oct 2004
Posts: 18
Location: Dunedin, FL
Reply with quote
I'm really interested in knowing this so if anyone has information regarding this post I'd appreciate it. Wink
bobclingan
Forum Regular

Joined: 16 Sep 2004
Posts: 271
Location: Abingdon, MD
Reply with quote
I'm pretty sure Enterprise Manager uses some internal stored procedures to work its magic, I've read that somewhere but can't recall where. You might be able to trace it by running Profiler while altering a table in Enterprise manager on a local box, I don't feel like running downstairs to try out my theory Smile.

As far as connecting quickly... try Aqua Data Studio- its way faster than Enterprise Manager and has Query Analyzer built in with some additional handy features.

http://www.aquafold.com
cbsinet.com


Joined: 04 Oct 2004
Posts: 18
Location: Dunedin, FL
Reply with quote
Those are some excellent ideas. I've heard of Aqua Data Studio before at a friend's house but I forgot about it somewhere along the line. At one point I got fed up and tried making my own enterprise manager. It was a good learning experience but I ran out of time and went back to other projects.
cbsinet.com


Joined: 04 Oct 2004
Posts: 18
Location: Dunedin, FL
Reply with quote
I've been using Aqua Data Studio now for a couple days and it's working out great but it does not let me alter tables visually still but I've learned my way around it for now.
bobum
Elvis Fanatic
Elvis Fanatic

Joined: 16 Nov 2004
Posts: 746
Location: Montgomery, AL
Reply with quote
Anyone tried this

ASP Enterprise Manager

it's supposed to be like PHPMyAdmin but for SQLServer...I loved PHPMyAdmin when I was a PHP developer
Josh
Forum Regular

Joined: 01 Apr 2004
Posts: 1031
Location: Felton, Delaware
Reply with quote
YES

I use it ALLLLL the time... Love it!!!
byron
Forum Admin

Joined: 07 Mar 2004
Posts: 160
Location: Newark, DE, USA
Reply with quote
There is a "colorder" column in the syscolumns table, which tracks this.

You can get the id of your table in the sysobjects table

declare @id int
select @id = id from sysobjects where name = 'mytable'
select * from syscolumns where id = @id

You can modify the colorder values to get what you want.
NickJushchyshyn


Joined: 10 Sep 2004
Posts: 5
Reply with quote
My first guess is that it made a temporary table with the following columns and dropped the columns being shifted then recreated the table and inserted the data back in.
This is basically it, really.
In fact, I'm pretty sure this is exactly what Enterprise Manager does. (Table objects end up with new object IDs after being "altered" in EM's design window.)

This is no biggie for small tables, but if you've got something with hundreds or thousands of megs of data in it, you should consider simply using the ALTER TABLE command. This is much faster than the temp table solution and EM (whatever process it uses.)
Table Aesthetics / Column Sort Order
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT  
Page 1 of 1  

  
  
 Reply to topic