• Status: Solved
  • Priority: Low
  • Security: Public
  • Views: 70
  • Last Modified:

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.
0
kowsika devi
Asked:
kowsika devi
  • 3
  • 3
1 Solution
 
Pawan KumarDatabase ExpertCommented:
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.
0
 
kowsika deviAuthor Commented:
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.
0
 
Pawan KumarDatabase ExpertCommented:
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
0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

 
kowsika deviAuthor Commented:
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_ArbitrationExpenses_D', N'U') is not null
    Truncate Table LGen_ArbitrationExpenses_D;

 Insert into  LGen_ArbitrationExpenses_D  (Pk_Id,Amount,CrtdBy,CrtdDt,ExpenseDt,ExpenseType,Hdr_Fk,HearingDate,LnNo,LnNo_Fk,LstModDt,MediaName,PublicationAgainst,PublicationDt)
 select Pk_Id,Amount,CrtdBy,CrtdDt,ExpenseDt,ExpenseType,Hdr_Fk,HearingDate,LnNo,LnNo_Fk,LstModDt,MediaName,PublicationAgainst,PublicationDt  
 from [192.169.1.77\sql12].SHRICITYUNO.dbo.LGen_ArbitrationExpenses_D  with(nolock)

 Go

is tere any way to do simple and common script jj.
0
 
Pawan KumarDatabase ExpertCommented:
No other way other than Generate Script. You can do a generate script and then remove tun unnecessary columns from the script by using find and delete.
1
 
kowsika deviAuthor Commented:
mmm k jj thanku
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now