October 16, 2008 at 5:14 am
Recently I bumped into something I have never given much thought off before. I needed to change an attribute in a table, which I wanted to script, because this change needed to be done on several servers. However, I could not find an ALTER TABLE CHANGE COLUMN option: it seems I have to drop a column and then add the column with the new datatype/nullability value. This means I have to write something to store the data in said column(2 mil records) to a temp-table and after the ALTER TABLE return said data to this column.
If I do this in EM all this is automayically taken care of. Now, I could find a server, where I can start a trace, execute the change on EM and lookup the statements in the trace and use them in my script.
Is this the only way to do this in TSQL? Do I miss an option in ALTER TABLE?
Greetz,
Hans Brouwer
October 16, 2008 at 5:56 am
Do you mean you want to do a ALTER TABLE ALTER COLUMN.....
October 16, 2008 at 6:53 am
(shame...)
Missed that completely...
Greetz,
Hans Brouwer
October 16, 2008 at 6:58 am
nah.....pretty bad with syntaxes myself...
October 16, 2008 at 7:05 am
No shame, we all miss things. That's why we help each other. It's a big, wide platform now, hard to remember everything or even the little details in things.
October 16, 2008 at 7:24 am
Steve,
Concur... Sometime we may miss what we know very well.
karthik
October 17, 2008 at 12:25 pm
FreeHansje (10/16/2008)
You can also, in EM, make your changes, but instead of hitting the save button, hit the little scroll looking button next to the save button, and it will give you the TSQL for the changes you just made. I think it was Sergiy who turned me on to this, and it has been very helpful to me, and easier than doing a trace.
Greg
_________________________________________________________________________________________________
The glass is at one half capacity: nothing more, nothing less.
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply