Archive | Microsoft SQL Server RSS feed for this section

19 August 2011 0 Comments

How to add new column to a MSSQL table between two existing columns

It’s possible but not as easy as ALTER TABLE [table] ADD COLUMN [column] [type] AFTER [anothercolumn]; like supported in MySql. We need to drop all contraints, create a temporary table with the new structure, copy all data to the temporary table, drop the old table and rename the temporary table. Below is a script that [...]

Tags:
17 May 2010 0 Comments

Re-map user to login in SQL server after restoring or attaching database

Re-map database user to a login in SQL server after restoring or attaching database When restoring or attaching a database to a new or different Microsoft SQL server the logins and mappings to the database users are lost. If you create the logins again you’re not able to map the users because they already exist [...]