Showing posts with label insert. Show all posts
Showing posts with label insert. Show all posts

Monday, February 20, 2012

Move data from one table to another

Trying to copy data from table one (name) to table two (n_system).
Field name.co_id to n_system.ultimate_id where name.id = n_system.id.
insert n_system (id, ultimate_id)
SELECT id, co_id FROM name
where name.id = n_system.id
Error message
Server: Msg 107, Level 16, State 3, Line 1
The column prefix 'n_system' does not match with a table name or alias
name used in the query.Use this format
insert into tabletwo select field1, field2 from tableone
Ben Nevarez, MCDBA, OCP
Database Administrator
"jp" wrote:

> Trying to copy data from table one (name) to table two (n_system).
> Field name.co_id to n_system.ultimate_id where name.id = n_system.id.
> insert n_system (id, ultimate_id)
> SELECT id, co_id FROM name
> where name.id = n_system.id
> Error message
> Server: Msg 107, Level 16, State 3, Line 1
> The column prefix 'n_system' does not match with a table name or alias
> name used in the query.
>|||Also, the problem is the where clause. You can not use n_system there in
that context. You need specify something, for example a constant
where name.id = 123
Ben Nevarez, MCDBA, OCP
Database Administrator
"Ben Nevarez" wrote:
[vbcol=seagreen]
> Use this format
> insert into tabletwo select field1, field2 from tableone
> Ben Nevarez, MCDBA, OCP
> Database Administrator
>
> "jp" wrote:
>

Move data from one table to another

Trying to copy data from table one (name) to table two (n_system).
Field name.co_id to n_system.ultimate_id where name.id = n_system.id.
insert n_system (id, ultimate_id)
SELECT id, co_id FROM name
where name.id = n_system.id
Error message
Server: Msg 107, Level 16, State 3, Line 1
The column prefix 'n_system' does not match with a table name or alias
name used in the query.Use this format
insert into tabletwo select field1, field2 from tableone
Ben Nevarez, MCDBA, OCP
Database Administrator
"jp" wrote:
> Trying to copy data from table one (name) to table two (n_system).
> Field name.co_id to n_system.ultimate_id where name.id = n_system.id.
> insert n_system (id, ultimate_id)
> SELECT id, co_id FROM name
> where name.id = n_system.id
> Error message
> Server: Msg 107, Level 16, State 3, Line 1
> The column prefix 'n_system' does not match with a table name or alias
> name used in the query.
>|||Also, the problem is the where clause. You can not use n_system there in
that context. You need specify something, for example a constant
where name.id = 123
Ben Nevarez, MCDBA, OCP
Database Administrator
"Ben Nevarez" wrote:
> Use this format
> insert into tabletwo select field1, field2 from tableone
> Ben Nevarez, MCDBA, OCP
> Database Administrator
>
> "jp" wrote:
> > Trying to copy data from table one (name) to table two (n_system).
> > Field name.co_id to n_system.ultimate_id where name.id = n_system.id.
> >
> > insert n_system (id, ultimate_id)
> > SELECT id, co_id FROM name
> > where name.id = n_system.id
> >
> > Error message
> > Server: Msg 107, Level 16, State 3, Line 1
> > The column prefix 'n_system' does not match with a table name or alias
> > name used in the query.
> >
> >

move data from Excel file to a table (MS SQL)

I have an application , user will read information in Excel file and insert that data into my application, I think it spend a lot of time. I want to make a tool which move data from Excel file to a table in My application (MS SQL) automaticly. How to do it, anybody has tool or know how to do, pls help me.
thanks.
MS SQL server is shiped with a component named ( Import And Export data) which you can use to convert your excel data into sql table
regards|||thank for your reply,
I think you did not understand my question. User is person which use my application , so they can not import excel to MS SQL, I would like develop a tool Which can read structure of Excel file to insert data from Excel into SQL server. How to do it
thanks