Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 import data

Author  Topic 

wided
Posting Yak Master

218 Posts

Posted - 2011-04-12 : 10:59:46
i want to import a data from access or an other database

i i imoprt all recors ; it is ok
but i want to import sum records (with selection), how to write a query (the syntax)



thanks

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2011-04-12 : 11:02:13
Give us more information if you want help. Please post data structures and required result set.
Go to Top of Page

wided
Posting Yak Master

218 Posts

Posted - 2011-04-12 : 11:19:29
Table in access look like this
exemple

table1
col1 col2
1 A
2 B
3 C

for the first time I import whole table
if other records are added to table "table1"

table1
col1 col2
1 A
2 B
3 C
4 D

I would like to import only the records that are not yet imported
(only 4 D)


Go to Top of Page

wided
Posting Yak Master

218 Posts

Posted - 2011-04-12 : 11:48:35
I need the syntax of the query in the wizard to import data
Go to Top of Page

wided
Posting Yak Master

218 Posts

Posted - 2011-04-12 : 13:08:07
I wait



I'll join tomorrow
thanks


ps: I am from TUNISIA
Go to Top of Page

wided
Posting Yak Master

218 Posts

Posted - 2011-04-13 : 04:31:28
good morning
Go to Top of Page

kanagarajnm
Starting Member

2 Posts

Posted - 2011-04-13 : 05:54:59
You can use the following query to INSERT only the records that are not available in table2.

INSERT INTO table2 SELECT col1,col2 FROM table1 WHERE NOT EXISTS(SELECT 1 FROM table2 WHERE table2.col1=table1.col1)
Go to Top of Page
   

- Advertisement -