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.
kowsika deviAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
kowsika deviAuthor Commented:
mmm k jj thanku
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
SQL

From novice to tech pro — start learning today.