How can I copy a table from a SQL Server to another? - sql-server

I've set up 2 local SQL server databases, one on a laptop and the other on my desktop, I simply want to transfer the data my laptop gathers onto my desktop PC.
I've already managed to connect the 2 machines, from my desktop's SSMS I can see and query the laptop database.
Now I only need to transfer the data from the laptpop Server to my desktop, I tried with a simple
SELECT *
INTO [DesktopDB].[dbo].[TargetTable]
FROM [LaptopIP].[LaptopDB].[dbo].[SourceTable]
But I get this error:
OLE DB provider "MSOLEDBSQL" for linked server "LaptopIP" returned message "Cannot generate SSPI context".
Msg -2146893042, Level 16, State 1, Line 0
SQL Server Network Interfaces: No credentials are available in the security package
Can you please help me address this issue?
Thank you very much!

For Windows auth to work between servers without a domain, your username and password must be the same on both servers.

You can connect remote sql server as Linked server, than insert data into local database table from linked server

Related

How to connect MicroStrategy 10 to SQL Server

I have a problem on connecting microstrategy to a local database:
I'm unable to resolve this error, though I have tried everything in ODBC origins, and tried various drivers.
The server name is correct (SQLExpress2017)
If anyone knows how to resolve this issue, please help.
How to connect Micro Strategy 10 to SQL Server
We cannot connect the SQL SERVER 2017 through local by making the sql server dynamic access by allowing TCP/IP using(sql configuration manager)
NOTE
1)Within your network your system be accessible making dynamic sql server
After create odbc in Microstrategy server.in creating ODBC password should be your sql server username and password and create database instance in microstrategy.using datawarehouse catalog fetch the table based upon the instance you created

How do I resolve encryption error connecting to SQL Server from Oracle SQL Developer

My objective is to use the migration tool in SQL Developer to migrate 2 SQL Server databases to Oracle. I am attempting to connect to a SQL Server database at a remote location using Oracle SQL Developer 4.0.
I have installed jtds.1.3.0.jar per instructions, and get the SQL Server and Sybase tabs in the connection properties window.
I have entered the user, pw, hostname, port, and database name. When I try to Retrieve Database, or connect, I get the error message:
Status : Failure -Test failed: I/O Error: DB server closed connection.
The SQL Server DBA tells me her error logs contain the following error message:
Encryption is required to connect to this server but the client library does not support encryption; the connection has been closed. Please upgrade your client library. [CLIENT: (my computer's IP address)] Error: 17835, Severity: 20, State: 1.
When I look at SQL Server documentation about this error message, it talks about certificates and SQL Server Connection Manager. Some relevant information to show that I've covered the basics:
Using the same connection parameters, I am able to connect to the SQL Server database using Toad for SQL Server.
Using the same connection parameters, a DBA set up an Oracle Transparent Gateway, and I can connect to the SQL Server database using the gateway and a database link. (As far as I know, neither of these methods required a certificate to connect.)
Both of these use ODBC; SQL Developer uses jdbc with TCP/IP.
The DBA assures me TCP/IP connection is turned on for the SQL Server databases.
I have gone into the XML file where SQL Developer stores the connection string. It has the form jdbc:jtds:sqlserver://sql-xxx-xxx.mw.nos.xxx.com:1433/my_db, which looks correct. I have tweaked it by adding the instance name, but no difference. The database has a default instance name, anyway, so it shouldn't be necessary.
A co-worker has been able to connect to a local SQL Server database on the same machine where SQL Developer was running (both on his laptop).
As a workaround, I am also pursuing the possibility of installing SQL Server on a local workstation, and copying the databases there for processing, but I don't know if I can get approval. If you know another tool for migrating from SQL Server to Oracle, please also let me know.
Thanks in advance.

SQL Server openrowset from csv on shared drive works from server not from desktop or app

I set up a stored procedure to import data from a csv file on a network drive. I trouble shoot all the previous errors and setting that are the usual requirements to make this work. I'll put that T/S info below with the boiled down code. I am at the point where this works perfectly when I run it from SSMS 2016, which is running on the windows 2012r2 server, which is running the sql server 2016, and I am logged in via Remote desktop as my network admin id. But does not work when I run it from SSMS 2016, which is running on windows 10 desktop, and I am logged it as the same admin id.
It also failed when I call the sp from the app on my desktop, which will be the actual place I want to call it from.
Code:
select *
from openrowset('MSDASQL'
,'Driver={Microsoft Access Text Driver (*.txt, *.csv)}'
,'select * from \\servername\public\Utilities\SWUMOps\BackEnd\saws\accts.csv')
Error from ssms on desktop:
OLE DB provider "MSDASQL" for linked server "(null)" returned message "[Microsoft][ODBC Text Driver] '\servername\public\Utilities\SWUMOps\BackEnd\saws' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides.".
Msg 7320, Level 16, State 2, Line 1
Cannot execute the query "select * from \servername\public\Utilities\SWUMOps\BackEnd\saws\accts.csv" against OLE DB provider "MSDASQL" for linked server "(null)".
.............
I've set the temp folder in the profile of the service id to everyone and domain users to modify
I have the 64bit driver loaded on the 64bit sql server
I have set 'Ad Hoc Distributed Queries', 1;
I verified the SQL Server service ID is in the Global group that has permissions to the folders and file on the remote share.
All the research I've done keep pointing me back the these steps above.
I also saw something about forcing tcp/ip instead of named pipes, but named pipes wasn't enabled, which it is now.
It seems to be related to how the permissions are used differently from when you run the tsql from on or off server , so I was hoping that would ring a bell for one of you fine folks.
Thanks
edit:
I also tested the sql svr service id by logging on to my desktop with it and opening the file on the unc path with no problems.

How to connect to SQL Server 2014 installed on one PC from a 2nd PC without Windows server and domain involved?

I have a Toshiba laptop with Windows 7 on which I have installed SQL Server 2014 for my database and use Microsoft Access 2016 to manage the data in a user-friendly way.
Everything worked perfectly fine till I tried to connect to the database from another PC on the same network, also with Windows 7.
I am able to connect to the database from the second PC using Microsoft SQL Server Management Studio and SQL Server Native Client 11.0, logging in as sa using SQL Server authentication.
However, when I open the Microsoft Access database file from the second PC, a window pops up, saying that:
See this image.
And when I press OK a second window pops:
See this image.
I have configured the database to use a specific TCP/IP = 1433
Also made new inbound rules in windows firewall for all SQL Server services.
Please note that there is no domain involved here. I don't have a Windows server and the SQL Server is installed on PC #1.
If you require more information, please tell me, I'll be happy to provide
Hope someone will be able to help!
try to use LINKSERVER
Using SQL Server Management Studio
To create a linked server to another instance of SQL Server Using SQL Server Management Studio
In SQL Server Management Studio, open Object Explorer, expand Server Objects, right-click Linked Servers, and then click New Linked Server.
On the General page, in the Linked server box, type the name of the instance of SQL Server that you area linking to.
SQL Server
Identify the linked server as an instance of Microsoft SQL Server. If you use this method of defining a SQL Server linked server, the name specified in Linked server must be the network name of the server. Also, any tables retrieved from the server are from the default database defined for the login on the linked server.
Other data source
Specify an OLE DB server type other than SQL Server. Clicking this option activates the options below it.
Provider
Select an OLE DB data source from the list box. The OLE DB provider is registered with the given PROGID in the registry.
Product name
Type the product name of the OLE DB data source to add as a linked server.
Data source
Type the name of the data source as interpreted by the OLE DB provider. If you are connecting to an instance of SQL Server, provide the instance name.
Provider string
Type the unique programmatic identifier (PROGID) of the OLE DB provider that corresponds to the data source. For examples of valid provider strings, see sp_addlinkedserver (Transact-SQL).
Location
Type the location of the database as interpreted by the OLE DB provider.
Catalog
Type the name of the catalog to use when making a connection to the OLE DB provider.
http://www.quackit.com/sql_server/sql_server_2014/tutorial/linked_servers.cfm

Link Server between 2 servers doesn't work but works on all other servers

A little background on what has been going on. I have been in the process of upgrading our sql server from 2008 R2 to 2012. The way I have been doing this is by taking the server to upgrade, lets call it Server A. Then taking a server a new server, lets call it Server C.
Moving all databases from Server A to Server C.
Renaming Server C to Server A and Server A to Server C.
Completely blowing away the Server C (old Server A).
Installing windows 2012, and SQL Server 2012 on Server.
Rename both servers to their original name.
The network team actually installed Windows server, got it on the network, etc. I only installed SQL Server 2012. I have done this with 8 servers and have had no problems from them so far. Both servers are running SQL Server 11.0.3373 windows version 6.2 build(9200). I also am sysadmin on all sql servers, but not a domain admin.
The issue
I am trying to create a link server from Server A to Server B. I can create the link server without an error, but i get an error when i use it in a query.
More relevant information
The firewall is turned off on Server B on all these tests.
I am able to ping Server A from Server B and vice versa.
I did a tracert and it comes up with the correct server and ip address( from both servers)
When I create the link server with *Other data source*
“Microsoft OLE DB Provider for SQL Server” or “SQL Server native Client 11.0”
I am able to query the master database when I query a user created database I get this error:
Msg 7314, Level 16, State 1, Line 1
The OLE DB provider "SQLNCLI11" for linked server "SERVER_B" does not contain the table ""UserDB"."dbo"."Table1"". The table either does not exist or the current user does not have permissions on that table.
SSMS
When I RDP into the Server A, run SSMS, try to connect to Server B I get this error:
"A transport-level error has occurred when receiving results from the server (Provider TCP Provider, error: 0- The specified network name is no longer available.) (Microsoft SQL Server Error: 64)"
RDP
When I try to RDP into Server B from Server A. I get an error that says "This computer can't connect to the remote computer. I also had a domain admin try and gets the same error.
Server B to A errors
I tried going the other way with it.
I RDP into Server B. In SSMS I try to connect to Server A. Below is the error i get.
A connection was successfully established with the server, but then an error occurred during the login process. (provider: TCP Provider, error: 0 - The semaphore timeout period has expired.) (.Net SqlClient Data Provider)
Any help would be appreciated.

Resources