.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Post New Web Links

SQL Server 2008 Linked Server SELECT INTO issue

Posted By:      Posted Date: August 30, 2010    Points: 0   Category :Sql Server
 
I have a SQL Server 2008 installation running on a clustered Windows Server 2008 R2. I am trying to execute a query on a remote SQL Server to create a table. In order to do so, I call a stored procedure on the remote SQL Server. The stored procedure's description is as follows: ------------------------------------- Create procedure [dbo].[USP_RemoteExec] @varSQL varchar(max) as declare @tempSql nvarchar(max); set @tempSql = CONVERT(nvarchar(max),@varSQL); exec sp_executesql @tempSql ------------------------------------- I pass the following command to the remote stored procedure as follows: exec [servername].[dbname].dbo.USP_RemoteExecute @varSQL='if object_id('testdb.dbo.tmp_testEmpty3') is not null drop table testdb.dbo.tmp_testEmpty3; create table testdb.dbo.tmp_testempty3(col1 int, col2 varchar(20));' go select * from [servername].testdb.dbo.tmp_testEmpty3 go This statement returns the following: --------------------------------- col1,col2 (0 row(s) affected) But, when I run the following statement: exec [servername].[dbname].dbo.USP_RemoteExecute @varSQL='if object_id('testdb.dbo.tmp_testEmpty') is not null drop table testdb.dbo.tmp_testEmpty; select * into testdb.dbo.tmp_testEmpty from (select top 10 mytab.[col1] as [col1] , mytab.[col2] as [col2] , mytab.[col3] as [col3] FROM testdb.dbo.mytab as [mytab] with (nolock)) as A' go select * from [


View Complete Post


More Related Resource Links

SQL Server 2008 Linked Server SELECT INTO issue

  
I have a SQL Server 2008 installation running on a clustered Windows Server 2008 R2. I am trying to execute a query on a remote SQL Server to create a table. In order to do so, I call a stored procedure on the remote SQL Server. The stored procedure's description is as follows: ------------------------------------- Create procedure [dbo].[USP_RemoteExec] @varSQL varchar(max) as declare @tempSql nvarchar(max); set @tempSql = CONVERT(nvarchar(max),@varSQL); exec sp_executesql @tempSql ------------------------------------- I pass the following command to the remote stored procedure as follows: exec [servername].[dbname].dbo.USP_RemoteExecute @varSQL='if object_id(''testdb.dbo.tmp_testEmpty3'') is not null drop table testdb.dbo.tmp_testEmpty3; create table testdb.dbo.tmp_testempty3(col1 int, col2 varchar(20));' go select * from [servername].testdb.dbo.tmp_testEmpty3 go This statement returns the following: --------------------------------- col1,col2 (0 row(s) affected) But, when I run the following statement: exec [servername].[dbname].dbo.USP_RemoteExecute @varSQL='if object_id(''testdb.dbo.tmp_testEmpty'') is not null drop table testdb.dbo.tmp_testEmpty; select * into testdb.dbo.tmp_testEmpty from (select top 10 mytab.[col1] as [col1] , mytab.[col2] as [col2] , mytab.[col3] as [col3] FROM testdb.dbo.mytab as [mytab] with (nolock)) as A' go select * from [

Linked server issue on test box, post upgrade 2005 to 2008 R2

  

In an effort to do some testing prior to upgrading our environment to 2008 R2, I made a test instance on our Dev box.  2005 instance, copied as many things as I could think of from various other instances.  Made a basic linked server to our main cluster, had a repeating job to email me results of a query across that link every few hours.

 

Everything was working fine until the upgrade finished.  It completed at ~7pm.  The email at 6PM came through fine (while the upgrade was in progress), the email at 8pm didn't come through.  Checked various things (DB mail was still working, tested fine).  It couldn't access the data across the linked server.  I tried deleting that link and remaking it.  Errors out.  Tried running the same scripts we use to create our standard linked servers, error out.  The only ones that I can set up and function are links to other instances on the same box.

I've looked around at other fixes for this error message and none seem to make any difference.  Log in with Domain cred's, log in with the sa account, no difference.  I can connect from other instances & servers back to this one, just not outbound from this one.  And it worked prior to the upgrade I applied to it.  All other instances on the box are 2005 as well.

Here is the message I ge

Issue with linked server 2008 (and R2) not an issue in 2005

  

Hi,

I have been using SQL 2005 successfully to connect to tables in a 10g Oracle data warehouse. I have been using the 11g client.

I have tried several times to get this working in SQL Server 2008 (and R2) and have tried the 10g and 11g clients...

I do a query like Select top 100 * from DWD..DW.IC_TRAN_PND and I get the error: 

"Invalid data for type "numeric".

 

I have read about the reasons for this but is there a way to make it work like it does in SQL server 2005?


Are linked servers an issue on SQL Server 2008 R2 64 bit platform?

  
Recently a Microsoft employee strongly recommended not using linked servers at all.   I have a different thread on this topic which died.  However, I'd like to get feedback regarding linked servers on SQL Server 2008 R2 64 bit platforms.
michelle jenks

issue with linked server from sql server 2008 to access 2003 database

  

hi,

I am trying to create a linked server from sql server 2008 to a secure access 2003 database(database which has a password), whatever options i am trying the result is i am getting the error 7399("Cannot start your application. The workgroup information file is missing or opened exclusively by another user.".) or error 7303.

I am selecting 'Microsoft.Jet.Oledb.4.0' as the provider. I think the problem is somewhere in

the workgroup files

Please help me in creating this linked server.

 

 


Word Automation Issue in Windows Server 2008 Hosting

  

Hi,

The problem I am posting here is that I was facing nearly 2 weeks around. Any body comes with this stuff please help.

Word Automation in sample ASP.NET(C#) application.

I am using Microsoft.Office.Inetrop.Word Assembly for automation. Here I am reading a XXX.dot template file and fill the contents with dynamic data.

When i am executing my code in localhost:someportnumber the automation is working fine and I could get expected result and when I am hosting in my inetmgr(Windows XP is my OS) it is also working fine.

But the problem is that when I am hosting in my production server(Windows Server 2008 Standard Edition) I am not able to perform automation and results in the following error.

Data: System.Collections.ListDictionaryInternal
Message: Word has encountered a problem.
Source: Microsoft Word

The code gets failed in the following line:

ApplicationClass wordApp = new Microsoft.Office.Interop.Word.ApplicationClass();

Document wordDoc = wordApp.Documents.Add(ref oTemplate, ref oFalse, ref oMissing, ref oMissing); // Error in this line

I cannot able to proceed further. Can anybody please help me in solving this issue?

Thank you.


With Regards,

Ashok



SQL Server 2008 Installation issue in Windows 7 64 bit

  
I'm trying to install SQL 2008, but an error message keeps appearing: Microsoft .NET Framework 3.5 installation has failed. SQL Server 2008 Setup requires .NET Framework 3.5 to be installed.   My OS is Windows 7 Ultimate 64 bits, so already has de .NET Framework 3.5, I turned on/off a lot of times and the same error occurs! I download the .NET Framework 3.5 and .NET Framework 3.5 SP1 from the links: (http://www.microsoft.com/downloads/details.aspx?FamilyId=333325fd-ae52-4e35-b531-508d977d32a6&displaylang=en http://www.microsoft.com/downloads/details.aspx?familyid=AB99342F-5D1A-413D-8319-81DA479AB0D7&displaylang=en) But, when installing the Framework 3.5 or the SP1, I get the message: "Use turn on or off disable features in Windows control panel".   Someone can help me?! - Windows 7 Ultimate 64 bits - SQL Server 2008 Developer (x86, x64, ia64).   Thanks! Marcelo.

Linked Server using ASE OLE DB Provider and Select * into where datetime maps to SQL Server datetime

  
Hi, I'm currently using MSSQL Server 2008 x64 SP1 [Microsoft SQL Server Standard Edition (64-bit)], version 10.0.2531.0.  I'm using Sybase ASE 15.0.3 ESD#3, or 15.5 ESD#1, and doing a simple Select into query where my original table on ASE, pubs..sales with DDL: stor_id     char(4)     not null, ord_num  varchar(20) not null, date         datetime    not null I run this query with Linked Server, using ASE OLE DB Provider x64, 15.5.0.1016: select * into mssql_sales from openquery(ASE1550, 'select * from pubs2..sales') The table mssql_sales has the datetime datatype from ASE mapped to datetime2(7). [With MSSQL Server 2005 the mapping is straight to datetime]. So far no problem.  However, if doing a bulk load out of this table, mssql_sales and trying to bulk into a table on MSSQL Server 2005: C:\Program Files\Microsoft SQL Server\100\Tools\Binn>bcp odbc.dbo.mssql_sales3 out c:\temp\mssql_sales3.dat -Spvero-2k8vm\pvms2008 -T -n -k Starting copy... 30 rows copied. Network packet size (bytes): 4096 Clock Time (ms.) Total     : 1      Average : (30000.00 rows per sec.) C:\Program Files\Microsoft SQL Server\100\Tools\Binn>bcp test.dbo.mssql_sales in c:\temp\mssql_sales3.dat -Spvero-2k3\pvms2005 -T -n -k Starting copy..

Problems with linked server to Analysis Services (SQL 2008)

  
I have problem with creating linked server from SQL database to Analsis services. BOth services are running on same machine. Operating system is Windows 2008. I create linked server (I use windows authentication and I am administrator on AS):  EXEC sp_addlinkedserver @server= 'OLAP_PRETOKI', @srvproduct = '', @provider='MSOLAP', @datasrc='localhost', @catalog='DWDatabase'  But when I try to test connection I get error (in the event log) and in the error log/dump I get this: 2010-09-03 13:48:28.41 Server Error: 17310, Severity: 20, State: 1. 2010-09-03 13:48:28.41 Server A user request from the session with SPID 57 generated a fatal exception. SQL Server is terminating this session. Contact Product Support Services with the dump produced in the log directory. 2010-09-03 13:48:32.53 spid58 Open of fault log C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\log\exception.log failed. 2010-09-03 13:48:32.65 spid58 Using 'dbghelp.dll' version '4.0.5' 2010-09-03 13:48:32.66 spid58 SqlDumpExceptionHandler: Process 58 generated fatal exception c0000005 EXCEPTION_ACCESS_VIOLATION. SQL Server is terminating this process. 2010-09-03 13:48:32.66 spid58 * ******************************************************************************* 2010-09-03 13:48:32.66 spid58 * 2010-09-03 13:48:32.66 spid58 * BEGIN STACK DUMP: 2010-09-03 13:4

Linked Server using ASE OLE DB Provider and Select * into where datetime maps to SQL Server datetime

  
Hi, I'm currently using MSSQL Server 2008 x64 SP1 [Microsoft SQL Server Standard Edition (64-bit)], version 10.0.2531.0.  I'm using Sybase ASE 15.0.3 ESD#3, or 15.5 ESD#1, and doing a simple Select into query where my original table on ASE, pubs..sales with DDL: stor_id     char(4)     not null, ord_num  varchar(20) not null, date         datetime    not null I run this query with Linked Server, using ASE OLE DB Provider x64, 15.5.0.1016: select * into mssql_sales from openquery(ASE1550, 'select * from pubs2..sales') The table mssql_sales has the datetime datatype from ASE mapped to datetime2(7). [With MSSQL Server 2005 the mapping is straight to datetime]. So far no problem.  However, if doing a bulk load out of this table, mssql_sales and trying to bulk into a table on MSSQL Server 2005: C:\Program Files\Microsoft SQL Server\100\Tools\Binn>bcp odbc.dbo.mssql_sales3 out c:\temp\mssql_sales3.dat -Spvero-2k8vm\pvms2008 -T -n -k Starting copy... 30 rows copied. Network packet size (bytes): 4096 Clock Time (ms.) Total     : 1      Average : (30000.00 rows per sec.) C:\Program Files\Microsoft SQL Server\100\Tools\Binn>bcp test.dbo.mssql_sales in c:\temp\mssql_sales3.dat -Spvero-2k3\pvms2005 -T -n -k Starting copy..

Problems with linked server to Analysis Services (SQL 2008)

  
I have problem with creating linked server from SQL database to Analsis services. BOth services are running on same machine. Operating system is Windows 2008. I create linked server (I use windows authentication and I am administrator on AS):  EXEC sp_addlinkedserver @server= 'OLAP_PRETOKI', @srvproduct = '', @provider='MSOLAP', @datasrc='localhost', @catalog='DWDatabase'  But when I try to test connection I get error (in the event log) and in the error log/dump I get this: 2010-09-03 13:48:28.41 Server Error: 17310, Severity: 20, State: 1. 2010-09-03 13:48:28.41 Server A user request from the session with SPID 57 generated a fatal exception. SQL Server is terminating this session. Contact Product Support Services with the dump produced in the log directory. 2010-09-03 13:48:32.53 spid58 Open of fault log C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\log\exception.log failed. 2010-09-03 13:48:32.65 spid58 Using 'dbghelp.dll' version '4.0.5' 2010-09-03 13:48:32.66 spid58 SqlDumpExceptionHandler: Process 58 generated fatal exception c0000005 EXCEPTION_ACCESS_VIOLATION. SQL Server is terminating this process. 2010-09-03 13:48:32.66 spid58 * ******************************************************************************* 2010-09-03 13:48:32.66 spid58 * 2010-09-03 13:48:32.66 spid58 * BEGIN STACK DUMP: 2010-09-03 13:4

SQLSERVER 2008 to SQL SERVER 2008 R2 REPORTS MIGRATION ISSUE?

  
Hi All, Yesterday we installed SQLSERVER 2008 R2 in our development mechine , and already it have Microsoft TFS 2008. When i open my report project it came up with the upgrade messagebox i clicked on Yes.And i try to run the reports locally its giving me exception like "An attempt has been made to  use the data extention 'custom datasource extention 1.2' that is eaither not registered for this report server or is not supported in this edition of reporting services'.So i did the changes like adding the dlls into the reportserver bin and added the data block which i have configured for SSRS 2008 i have applied the same setting for the SSRS 2008 R2 but still i am gettign the same exception do we need to do any changes in SSRS 2008 R2. because i am able to run the reports sucessuflly in SSRS 2008 but not SSRS 2008 R2? Any body have ideas on this. Thanks, Veeren.

Linked Server using ASE OLE DB Provider and Select * into where datetime maps to SQL Server datetime

  
Hi, I'm currently using MSSQL Server 2008 x64 SP1 [Microsoft SQL Server Standard Edition (64-bit)], version 10.0.2531.0.  I'm using Sybase ASE 15.0.3 ESD#3, or 15.5 ESD#1, and doing a simple Select into query where my original table on ASE, pubs..sales with DDL: stor_id     char(4)     not null, ord_num  varchar(20) not null, date         datetime    not null I run this query with Linked Server, using ASE OLE DB Provider x64, 15.5.0.1016: select * into mssql_sales from openquery(ASE1550, 'select * from pubs2..sales') The table mssql_sales has the datetime datatype from ASE mapped to datetime2(7). [With MSSQL Server 2005 the mapping is straight to datetime]. So far no problem.  However, if doing a bulk load out of this table, mssql_sales and trying to bulk into a table on MSSQL Server 2005: C:\Program Files\Microsoft SQL Server\100\Tools\Binn>bcp odbc.dbo.mssql_sales3 out c:\temp\mssql_sales3.dat -Spvero-2k8vm\pvms2008 -T -n -k Starting copy... 30 rows copied. Network packet size (bytes): 4096 Clock Time (ms.) Total     : 1      Average : (30000.00 rows per sec.) C:\Program Files\Microsoft SQL Server\100\Tools\Binn>bcp test.dbo.mssql_sales in c:\temp\mssql_sales3.dat -Spvero-2k3\pvms2005 -T -n -k Starting copy..

SQL Server 2008 installation issue

  
While i was installing SQL Serve 2008 Client instead of getting feature selection screen i am getting 'provide the path of sql server 2008 installation media'. What does it mean? help .... Thanks in advance

Deadlock issue in SQL Server 2008 R2 (.Net 2.0 Application)

  
The Sql Server 2008 R2 instance in question is a heavy load OLTP production server. The deadlock issue came up a few days back and is still unresolved. We received the Xml deadlock report that listed the stored procedures involved in the deadlock and some other details. I'll try to list down the facts from this xml first: Two stored procedures are involved in the deadlock, say SP1 and SP2. According to the report SP1 was running in Isolation level "Serializable" and SP2 was running in "ReadCommitted" . We have investigated the following: Are we setting IsolationLevel of SP1 to "Serializable" inside SP or in Code? - No. Is any other SP whose IsolationLevel is "Serializable" calling SP1? - No. Are the table used by SP1 called by any other SP that has Isolation Level as "Serializable"? - Yes. There are SPs that have Isolation Level set to "Serializable" and access the same tables as SP1, but we don't know whether they were running at the time of deadlock or not as the deadlock report only showed SP1 and SP2. Lines of thought: We have considered the following possible causes: Deadlock is occurring because SP1 is running as "Serializable". - Why is this SP running in Serializable when I haven't set it? Is the Isolation level escalating (like locks do)? If we figure this out and make it run as ReadCom

Win server 2003+ Sharepoint 2007+SQL Server 2008 ,reports view issue?

  

I hope someone may shed some light on a serious obstacle encountered on a client site:

We have implemented a SharePoint integrated report services solution for the client on a single server

Server = Windows 2003

SQL = 2008

MOSS 2007

Web application = servername:8888 (default) - windows auth

Web application extension 1 servername:8889 (extranet) forms auth

Web application extension 2 servername:8887 (intranet) forms auth

Reports are visible and can be run (renders) on internal sites

However, there is an external site which allows users to access the reports - the issue is, the reports then dont run and I get this:

"An unexpected error occurred while connecting to the report server. Verify that the report server is available and configured for SharePoint integrated mode."

Though I have not actually seen the firewall config of the AAM, the client assures me it has been setup properly.

If the AAM is setup correctly, what could be the problem? The server is clearly available and confgured in SharePoint integrated mode.

 

has anyone experienced the scenario where clients want to publish their reports on an external site? What can one do to see any errors other than the one line message (tried enabling custom errors, but no good)


Linked Server UPDATE issue

  

Hello forum,

I'm doing a simple data load between two linked servers, and everything is working fine until I include an UPDATE statement, that's when I receive the following error message.

OLE DB provider "SQLNCLI10" for linked server "ServerName" returned message "The partner transaction manager has disabled its support for remote/network transactions.".

Msg 7391, Level 16, State 2, Line 28

The operation could not be performed because OLE DB provider "SQLNCLI10" for linked server "ServerName" was unable to begin a distributed transaction.


the Distribute Transaction Coordinator service is running on all machines, and I'm able to do INSERTs between the two servers. Here is a part of the code I'm using. It works fine if I don't include the UPDATE. 


BEGIN TRAN
DECLARE @TempTable TABLE(PDID INT
			,FirstName VARCHAR(MAX)
			,LastName VARCHAR(MAX)
			,Degree 
Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend