| Author |
Topic |
|
ConradK
Posting Yak Master
140 Posts |
Posted - 2010-12-15 : 18:36:01
|
| So I'm sure we all know how awesome the import/export wizard is. But its a little slow and I'm sick of doing the same things over and over again.So. I was hoping you could let me know what the sql looks like that I could execute to do what the import export wizard is doing?I'll walk you through what I do like 5 times a day.1. Open Wizard2. Data Scource: "Sql Server native Client 10.0"3. Server name: "Main Server"4. Authentication: Use Windows Authentication5. Database: "MainDB"Click Next6. Destination "Sql Server native Client 10.0"7. Server Name: "My Personal Server"8. Authentication: Use Windows Authentication9. Database: "MainDB"Click Next10. Copy Data from one or more tables or viewsClick Next11. Toggle Check Boxes by the tables I wantPress FinishPress FinishPREST0O!!!!!! I get what I need.What does the SQL commands executing this look like ?~!??~?~ |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
ConradK
Posting Yak Master
140 Posts |
Posted - 2010-12-15 : 19:12:01
|
quote: Originally posted by tkizer Or use a linked server:INSERT INTO LinkedServerName.Db1.dbo.Tbl1 (...)SELECT ...FROM Db1.dbo.Tbl1Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Subscribe to my blog
Tell me more about this. Can you write exactly what the query would look like given the sample info I gave you? Because I've taken these kinds of basics, and always get werid permission denials. But the thing is, if I can do it with the wizard, obviously I have the permissions needed to do this.... |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
ConradK
Posting Yak Master
140 Posts |
Posted - 2010-12-15 : 19:53:58
|
| hmmmm.... I want to link servers, but can't seem to make it work then I guess.... I'm not interested in importing and exporting csvs. |
 |
|
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2010-12-16 : 00:27:14
|
| Then you just need to create a linked server.INSERT myTableSELECT <fieldList>FROM otherServer.DatabaseName.dbo.TableName;If you have issues creating a linked server, let's hear about that. We'll help ya along. |
 |
|
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2010-12-16 : 00:28:27
|
| By the way, almost everything you can do from the GUI can be captured by profiler so you can see the T-SQL commands for yourself.This, unfortunately, is not one of those cases, but do keep it in mind for other exercises. |
 |
|
|
ConradK
Posting Yak Master
140 Posts |
Posted - 2010-12-16 : 11:31:31
|
| Well I don't even know where to begin. In my company I have a server on my local machine, and then we have the 'company' server. I'm not sure how to connect or link them, what command to use or ANYTHING. I don't even know where to start.I imagine http://msdn.microsoft.com/en-us/library/ms190479.aspx is telling me what to do, and I've used this to connect xlses, looks like this:EXEC sp_addlinkedserver 'awesome', 'Jet 4.0', 'Microsoft.Jet.OLEDB.4.0', 'C:\SKUM\opossum.xls', NULL, 'Excel 8.0'GObut I dunno how to use this to connect the server in the other room on my network.... For some reason its just not making sense to my skull. |
 |
|
|
|