kowsika devi
asked on
sql server index 2012
how to move selected column in the table from one server to another server with out droping constrains and indexes in sql server 2012.
Do you want to remove the column from the table. If yes it is not possible with dropping depending object like constrains and indexes in SQL Server.
ASKER
hi jj
all the tables with selected columns copied on to a different database with the 'Select * Into...' clause from one server to another. But this statement does not transfer constraints and indexes. How do we transfer the constraints and indexes to the destination server.
all the tables with selected columns copied on to a different database with the 'Select * Into...' clause from one server to another. But this statement does not transfer constraints and indexes. How do we transfer the constraints and indexes to the destination server.
Generate Scripts is the answer-
Go to SSMS -> Choose your database -> tasks-> Generate scripts -> Next
-> Script Check Constraints to true
-> Script Indexes to true
-> ScriptDependencies to true
-> Select the tables you need
-> next -> next ->
read more from here
Go to SSMS -> Choose your database -> tasks-> Generate scripts -> Next
-> Script Check Constraints to true
-> Script Indexes to true
-> ScriptDependencies to true
-> Select the tables you need
-> next -> next ->
read more from here
ASKER
i need selected columns alone if i use the generate scripts it comes all the column in the specified table jj. iam doing now trunctate table and selecting the columns and inserting . like this
if OBJECT_ID(N'LGen_Arbitrati onExpenses _D', N'U') is not null
Truncate Table LGen_ArbitrationExpenses_D ;
Insert into LGen_ArbitrationExpenses_D (Pk_Id,Amount,CrtdBy,CrtdD t,ExpenseD t,ExpenseT ype,Hdr_Fk ,HearingDa te,LnNo,Ln No_Fk,LstM odDt,Media Name,Publi cationAgai nst,Public ationDt)
select Pk_Id,Amount,CrtdBy,CrtdDt ,ExpenseDt ,ExpenseTy pe,Hdr_Fk, HearingDat e,LnNo,LnN o_Fk,LstMo dDt,MediaN ame,Public ationAgain st,Publica tionDt
from [192.169.1.77\sql12].SHRIC ITYUNO.dbo .LGen_Arbi trationExp enses_D with(nolock)
Go
is tere any way to do simple and common script jj.
if OBJECT_ID(N'LGen_Arbitrati
Truncate Table LGen_ArbitrationExpenses_D
Insert into LGen_ArbitrationExpenses_D
select Pk_Id,Amount,CrtdBy,CrtdDt
from [192.169.1.77\sql12].SHRIC
Go
is tere any way to do simple and common script jj.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
mmm k jj thanku