Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Need some help with SQL

tom3297
 Share

Ik trying to connect two databases in Microsoft SQL.

I need to move data from one to the other. to do this i made a linked Database.

Now im trying to move data from a Table1 on the linked server to a table on the server ill be using.

But i only want to move specific Collums to an other specific Collum.

And to make is extra difficult i need to put a C in the first Collum of everything i add do it will know what is added.

 

Thanks in advance.

Link to comment
Share on other sites

Link to post
Share on other sites

Can you give us column names or something?

75% of what I say is sarcastic

 

So is the rest probably

Link to comment
Share on other sites

Link to post
Share on other sites

My experience with MSSQL is limited, but if you are using two seperate databases you will likely need to specify the schema.table.column in your references.

I don't understand what you mean by adding a 'C' to the column. Do you mean you are changing the name of the column or are you trying to concatenate a 'C' to your data import?

Link to comment
Share on other sites

Link to post
Share on other sites

54 minutes ago, tom3297 said:

Ik trying to connect two databases in Microsoft SQL.

I need to move data from one to the other. to do this i made a linked Database.

Now im trying to move data from a Table1 on the linked server to a table on the server ill be using.

But i only want to move specific Collums to an other specific Collum.

And to make is extra difficult i need to put a C in the first Collum of everything i add do it will know what is added.

 

Thanks in advance.

is it a one time move or you will have to keep it up to date ?

Link to comment
Share on other sites

Link to post
Share on other sites

27 minutes ago, myselfolli said:

Can you give us column names or something?

so the data needs to go,

from SRVSQL03 database TPD_PROD Table dbo.hardware

 

To SRV-MDT-01 database MDT  Table dbo.settings

From colum naam               to colum OSDComputerName

From colum objectid           to colum ID

And Add C                          to colum Type

 

To SRV-MDT-01 database MDT  Table dbo.computerIdentity

From colum naam               to colum Description

From colum Serienummer  to colum SerialNumber

From colum objectid           to colum ID

 

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, Franck said:

is it a one time move or you will have to keep it up to date ?

It Needs to be kept up to date.

 

Link to comment
Share on other sites

Link to post
Share on other sites

5 minutes ago, tom3297 said:

It Needs to be kept up to date.

 

Then you better use replication. What you do is tell your dev server to be a replication and you select your table.

Then your production server you make it subscribe to the other server. And for your 2 different tables you should create 2 views.

 

Replication is like a auto backup and restore ish kind of thing. There could be a couple milliseconds delay in between both table state.

Link to comment
Share on other sites

Link to post
Share on other sites

  • 5 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share


×