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.
| Author |
Topic |
|
skas502
Starting Member
6 Posts |
Posted - 2007-11-05 : 20:58:19
|
| We have two instances of SQL Server 2005 running. One is production and other one is Dev. I have inserted two new fields into an existing table in Dev instance. Now I want to generate a script which can be run in the production environment so that same fields can be added in the production table too. Urgent reply from anyone would be highly appreciated.Thanks |
|
|
rmiao
Master Smack Fu Yak Hacker
7266 Posts |
Posted - 2007-11-05 : 21:16:55
|
| You can generate script for tale in dev instance in ssms, modify the script then run the script to add columns in prod instance. |
 |
|
|
skas502
Starting Member
6 Posts |
Posted - 2007-11-05 : 21:23:43
|
| I am new to the SQL Server. Can anyone please give me example of script. Thanks |
 |
|
|
rmiao
Master Smack Fu Yak Hacker
7266 Posts |
Posted - 2007-11-05 : 21:30:59
|
| Take look at 'generate script' in books online. |
 |
|
|
skas502
Starting Member
6 Posts |
Posted - 2007-11-05 : 23:29:03
|
| After some research I generated following script. Now my question here is this script does not identify the database name. If there are several databases are running on production server how will this script identify the database name? Is there any option to include database name in the following script? ThanksBEGIN TRANSACTIONSET QUOTED_IDENTIFIER ONSET ARITHABORT ONSET NUMERIC_ROUNDABORT OFFSET CONCAT_NULL_YIELDS_NULL ONSET ANSI_NULLS ONSET ANSI_PADDING ONSET ANSI_WARNINGS ONCOMMITBEGIN TRANSACTIONGOALTER TABLE dbo.Table1 ADD NewColumn nvarchar(250) NULLGOCOMMIT |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-11-05 : 23:32:22
|
it will run in current database context. Add "use <database_name> to change the current database context KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
skas502
Starting Member
6 Posts |
Posted - 2007-11-06 : 13:07:14
|
| I get this error on ASP page after adding the columns into my table with script. If I add columns manuallyinto the table ASP pages work fine.Error Type:Microsoft VBScript runtime (0x800A0009)Subscript out of range: 'Index'/GSCOM/GroupShareSecure/newClasses/clsBaseCollection.asp, line 23 |
 |
|
|
|
|
|