Quantcast
Channel: SQL Server Database Engine forum
Viewing all 12963 articles
Browse latest View live

sql sentry vs idera vs Quest

$
0
0

Any suggestions on what's a good tool out there for the DBAs to manage and monitor their SQL Servers ?

 

These 3 seem popular : sql sentry vs idera vs Quest

 

Any recommendations on one that might be a clear winner..  or one to avoid...

 


Named instances and port nr

$
0
0

Hi, I created a named instance on a SQL server for a specific application.

Some users need to connect to this instance now to read some data. They connect to the 'servername\instancename' on port 1433.

They're connection fail. (Login failed )

Only port 1433 is open in the firewall from his system to my sql server.

I am a bit confused.. Should each named instance run on its own dedicated port? Should the dynamic port be disabled?

Thanks in advance!

I want to know what should do if the SPID : 12 Checkpoint is taking time.

$
0
0

Hi Team,

I want to know what should do if the SPID : 12 Checkpoint is taking time.

I can't kill it also.


Thanks

Named instances and port nr

$
0
0

Hi, I created a named instance on a SQL server for a specific application.

Some users need to connect to this instance now to read some data. They connect to the 'servername\instancename' on port 1433.

They're connection fail. (Login failed )

Only port 1433 is open in the firewall from his system to my sql server.

I am a bit confused.. Should each named instance run on its own dedicated port? Should the dynamic port be disabled?

Thanks in advance!

Specialist Database

$
0
0

Hi, 

I am facing issue of deadlock and exclusive locks on some of tables for Hybris application. Using MSSQL 2008 R2 standard edition.

Case is Update hits database and take X lock on val1 record and goes in sleeping mode. When update is in sleeping mode and lock is not release, during that all select comes to that table get suspended. That is creating some deadlock or intensive blocking in database. 

As of now i have applied following solutions: 

- Covering index has been introduced for some of columns in select

- Updated STATS for tables in scope of UPDATE and SELECT 

- Rebuilt indexes on regular basis 

But problem frequency is reduced but not permanently resolved. Any help appreciated here.. 


Problem with dates from Advantage Database Server

$
0
0

I have been chasing this problem for a few days.

We have a SQL Server 2008 R2 environment that uses a linked server to get data from a stored procedure in Advantage Database Server using OLE.  Some of the data retrieved are dates and everything seems to work fine in our current environment.

We are building a separate environment to mimic the one above.  Same version of SQL Server 2008 R2, same version of Advantage Database Server.  However, in the new environment, when a date is hit that is out of range (i.e., 10-31-0214, instead of 10-31-2014) an error is thrown:

Msg 8114, Level 16, State 10, Line 1

Error converting data type DBTYPE_DBDATE to datetime.

I don't see any difference between the environments.  I am obviously missing something.  I believe it to be on the SQL Server side because when I log into Advantage and run the stored procs there, then the data is fine.  It only appears to be when bringing the data across the OLE connection.

Does anyone out there have any suggestions?

Thanks

 

SQL Table to access table

$
0
0

Can anyone help me here ? 

I want to get the sql server table into access database . 

I have tried below code from some Internet source but it didn't worked 

Public Sub test1()

Dim conn As ADODB.Connection '<<<connection to SQL Server
Dim rst As ADODB.Recordset '<<<Recordset for SQL Server
Dim dbConn As ADODB.Connection '<<<connection for current access db
Dim sqlq As String


'create connection to external database
Set conn = New ADODB.Connection
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=" & ServerName & ""
'On Error GoTo err

'Db.Open "Provider=SQLOLEDB.1;Data Source=" & ServerName & ";" & _
        'Initial Catalog=" & DatabaseName & ";User ID=TestID;Password=srm"


'pull records from database into recordset
Set rst = New ADODB.Recordset
rst.Open "SELECT * FROM Tbl_HRBPO_BAC_OMT_CS_Data "

Set dbConn = CurrentProject.Connection

'move through each record and load it into the local access database using Execute method
rst.MoveFirst
Do While Not rst.EOF
sqlq = "INSERT INTO newt VALUES('" & rst.Fields(0).Value & "', '" & rst.Fields(1).Value & "')"
dbConn.Execute sqlq

rst.MoveNext
Loop

dbConn.Close
Set dbConn = Nothing
rst.Close
conn.Close
Set rst = Nothing
Set conn = Nothing
End Sub

Thanks in advance 

how to remove the selected owned schema in a database user in security

$
0
0

Hi all,



I am using SQL Server mgmt studio with 2005 db. I accidentally clicked the
owned schema while in a database user in security. When I went back to
remove the check boxes they were greyed out. How do I remove them?

Regards,

anjali


sharedmanagementobjects.msi won't install

$
0
0

I have a tool that utilizes the SQL Server Management Objects, but I'm having a hard time installing them on a Win8.1 x64 workstation.

I've installed the 32/64 bit versions of the SQL Server CLR types, and they are listed in the workstations programs and features list, but sharedmanagementobjects.msi throws an error:

The link in the message brings up the SQL Server 2008 SP3 Feature Pack page.

Any suggestions?

SQLServerAgent could not be started (reason: Unable to connect to server ''; SQLServerAgent cannot start)

$
0
0

Unable to start SQL Agent SQL Server 2008 R2 RTM OS: Windows 2008 R2

Agent Log

2012-04-17 22:17:22 - ! [298] SQLServer Error: 27, Registry information is corrupt or missing. Make sure the provider installed and registered correctly. [SQLSTATE 08001]
2012-04-17 22:17:22 - ! [298] SQLServer Error: 27, Client unable to establish connection [SQLSTATE 08001]
2012-04-17 22:17:22 - ! [165] ODBC Error: 0, A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online. [SQLSTATE 08001]
2012-04-17 22:17:22 - ! [000] Unable to connect to server '(local)'; SQLServerAgent cannot start
2012-04-17 22:17:22 - ! [298] SQLServer Error: 27, Registry information is corrupt or missing. Make sure the provider installed and registered correctly. [SQLSTATE 08001]
2012-04-17 22:17:22 - ! [298] SQLServer Error: 27, Client unable to establish connection [SQLSTATE 08001]
2012-04-17 22:17:22 - ! [165] ODBC Error: 0, A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online. [SQLSTATE 08001]
2012-04-17 22:17:22 - ! [382] Logon to server '(local)' failed (DisableAgentXPs)
2012-04-17 22:17:23 - ? [098] SQLServerAgent terminated (normally)

EventLog:

SQLServerAgent could not be started (reason: Unable to connect to server '<ServerNAme>'; SQLServerAgent cannot start).

TITLE: Microsoft SQL Server Management Studio
------------------------------

Unable to start service SQLSERVERAGENT on server <Server Name>. (mscorlib)

------------------------------
ADDITIONAL INFORMATION:

The SQLSERVERAGENT service on <Server Name> started and then stopped. (ObjectExplorer)

------------------------------
BUTTONS:

OK
------------------------------

Uninstalled couple of times and Reinstall still getting the same Error and also tried below workarounds:

sp_configure 'show advanced options', 1;  
GO  
RECONFIGURE;  
GO  
sp_configure 'Agent XPs', 1;  
GO  
RECONFIGURE  
GO


[HKLM\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\SQLServerAgent] PATH is Correct

Can you please share with you if have any fix for this issue.

Note: Services are running under service account [Domain Account] and also has SA privilage.

Thanks

Nag


Nag Pal MCTS/MCITP (SQL Server 2005/2008) :: Please Mark Answer/vote if it is helpful ::

SQLServerAgent could not be started (reason: Unable to connect to server '(local)'; SQLServerAgent

$
0
0

Dear all,
i have a Windows 2008 Server (X64) with SQL 2005 SP3 and some troubels...
The SQL works since some week, this week we installed SQL SP3 and change of the local Admin password.
Yesterday we reboot  the Server, now the SQL Server Agent is unable to start!

The SQL Server is up and running,
Errorlog:

2009-11-06 09:49:52.56 Server      Microsoft SQL Server 2005 - 9.00.4035.00 (X64)
 Nov 24 2008 16:17:31
 Copyright (c) 1988-2005 Microsoft Corporation
 Standard Edition (64-bit) on Windows NT 6.0 (Build 6002: Service Pack 2)

2009-11-06 09:49:52.56 Server      (c) 2005 Microsoft Corporation.
2009-11-06 09:49:52.56 Server      All rights reserved.
2009-11-06 09:49:52.56 Server      Server process ID is 5912.
2009-11-06 09:49:52.56 Server      Authentication mode is WINDOWS-ONLY.
2009-11-06 09:49:52.56 Server      Logging SQL Server messages in file 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\LOG\ERRORLOG'.
2009-11-06 09:49:52.56 Server      This instance of SQL Server last reported using a process ID of 4424 at 11/6/2009 9:43:23 AM (local) 11/6/2009 8:43:23 AM (UTC). This is an informational message only; no user action is required.
2009-11-06 09:49:52.56 Server      Registry startup parameters:
2009-11-06 09:49:52.56 Server        -d C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\master.mdf
2009-11-06 09:49:52.56 Server        -e C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\LOG\ERRORLOG
2009-11-06 09:49:52.56 Server        -l C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\mastlog.ldf
2009-11-06 09:49:52.59 Server      SQL Server is starting at normal priority base (=7). This is an informational message only. No user action is required.
2009-11-06 09:49:52.59 Server      Detected 4 CPUs. This is an informational message; no user action is required.
2009-11-06 09:49:52.67 Server      Using dynamic lock allocation.  Initial allocation of 2500 Lock blocks and 5000 Lock Owner blocks per node.  This is an informational message only.  No user action is required.
2009-11-06 09:49:52.71 Server      Attempting to initialize Microsoft Distributed Transaction Coordinator (MS DTC). This is an informational message only. No user action is required.
2009-11-06 09:49:53.73 Server      Attempting to recover in-doubt distributed transactions involving Microsoft Distributed Transaction Coordinator (MS DTC). This is an informational message only. No user action is required.
2009-11-06 09:49:53.73 Server      Database mirroring has been enabled on this instance of SQL Server.
2009-11-06 09:49:53.73 spid4s      Starting up database 'master'.
2009-11-06 09:49:53.86 spid4s      Recovery is writing a checkpoint in database 'master' (1). This is an informational message only. No user action is required.
2009-11-06 09:49:53.95 spid4s      SQL Trace ID 1 was started by login "sa".
2009-11-06 09:49:53.97 spid4s      Starting up database 'mssqlsystemresource'.
2009-11-06 09:49:53.99 spid4s      The resource database build version is 9.00.4035. This is an informational message only. No user action is required.
2009-11-06 09:49:54.16 spid9s      Starting up database 'model'.
2009-11-06 09:49:54.17 spid4s      Server name is 'VIE-EU-ARC-02'. This is an informational message only. No user action is required.
2009-11-06 09:49:54.19 Server      The certificate was successfully loaded for encryption.
2009-11-06 09:49:54.19 Server      Server is listening on [ 'any' <ipv6> 1433].
2009-11-06 09:49:54.19 Server      Server is listening on [ 'any' <ipv4> 1433].
2009-11-06 09:49:54.19 Server      Server local connection provider is ready to accept connection on [
\\.\pipe\SQLLocal\MSSQLSERVER ].
2009-11-06 09:49:54.19 Server      Server local connection provider is ready to accept connection on [
\\.\pipe\sql\query ].
2009-11-06 09:49:54.19 Server      Server is listening on [ ::1 <ipv6> 1434].
2009-11-06 09:49:54.19 Server      Server is listening on [ 127.0.0.1 <ipv4> 1434].
2009-11-06 09:49:54.19 Server      Dedicated admin connection support was established for listening locally on port 1434.
2009-11-06 09:49:54.31 Server      SQL Server is now ready for client connections. This is an informational message; no user action is required.
2009-11-06 09:49:54.33 spid15s     Starting up database 'AdventureWorks'.
2009-11-06 09:49:54.33 spid16s     Starting up database 'EnterpriseVaultDirectory'.
2009-11-06 09:49:54.33 spid14s     Starting up database 'Test'.
2009-11-06 09:49:54.33 spid12s     Starting up database 'AdventureWorksDW'.
2009-11-06 09:49:54.33 spid17s     Starting up database 'EnterpriseVaultMonitoring'.
2009-11-06 09:49:54.33 spid13s     Starting up database 'msdb'.
2009-11-06 09:49:54.33 spid23s     Starting up database 'EVVSExchangeVaultStore_2'.
2009-11-06 09:49:54.33 spid22s     Starting up database 'EVVSGVIE_2_2'.
2009-11-06 09:49:54.33 spid24s     Starting up database 'EVVSJournalVaultStore_3'.
2009-11-06 09:49:54.33 spid19s     Starting up database 'EVVSVIEIT_1'.
2009-11-06 09:49:54.33 spid21s     Starting up database 'ReportServerTempDB'.
2009-11-06 09:49:54.33 spid20s     Starting up database 'ReportServer'.
2009-11-06 09:49:54.33 spid18s     Starting up database 'EVVSGVIEIT_1_1'.
2009-11-06 09:49:54.56 spid9s      Clearing tempdb database.
2009-11-06 09:49:54.61 spid19s     CHECKDB for database 'EVVSVIEIT_1' finished without errors on 2009-10-28 18:06:14.107 (local time). This is an informational message only; no user action is required.
2009-11-06 09:49:54.65 spid23s     CHECKDB for database 'EVVSExchangeVaultStore_2' finished without errors on 2009-11-04 18:05:33.960 (local time). This is an informational message only; no user action is required.
2009-11-06 09:49:54.71 spid24s     CHECKDB for database 'EVVSJournalVaultStore_3' finished without errors on 2009-11-04 18:05:51.793 (local time). This is an informational message only; no user action is required.
2009-11-06 09:49:54.75 spid16s     CHECKDB for database 'EnterpriseVaultDirectory' finished without errors on 2009-11-04 18:06:38.103 (local time). This is an informational message only; no user action is required.
2009-11-06 09:49:54.83 spid17s     CHECKDB for database 'EnterpriseVaultMonitoring' finished without errors on 2009-11-04 18:06:18.570 (local time). This is an informational message only; no user action is required.
2009-11-06 09:49:54.99 spid4s      Recovery of any in-doubt distributed transactions involving Microsoft Distributed Transaction Coordinator (MS DTC) has completed. This is an informational message only. No user action is required.
2009-11-06 09:49:55.55 spid9s      Starting up database 'tempdb'.
2009-11-06 09:49:55.68 spid4s      Recovery is complete. This is an informational message only. No user action is required.
2009-11-06 09:49:55.68 spid12s     The Service Broker protocol transport is disabled or not configured.
2009-11-06 09:49:55.68 spid12s     The Database Mirroring protocol transport is disabled or not configured.
2009-11-06 09:49:55.72 spid12s     Service Broker manager has started.

Only the SQL Server Agent is unable to start,
Eventlog:

Log Name:      Application
Source:        SQLSERVERAGENT
Date:          06.11.2009 10:09:52
Event ID:      103
Task Category: Service Control
Level:         Error
Keywords:      Classic
User:          N/A
Computer:      vie-eu-arc-02.global.domain
Description:
SQLServerAgent could not be started (reason: Unable to connect to server '(local)'; SQLServerAgent cannot start).
Event Xml:
<Event xmlns="
http://schemas.microsoft.com/win/2004/08/events/event">
  <System>
    <Provider Name="SQLSERVERAGENT" />
    <EventID Qualifiers="16384">103</EventID>
    <Level>2</Level>
    <Task>2</Task>
    <Keywords>0x80000000000000</Keywords>
    <TimeCreated SystemTime="2009-11-06T09:09:52.000Z" />
    <EventRecordID>8486</EventRecordID>
    <Channel>Application</Channel>
    <Computer>vie-eu-arc-02.global.domain</Computer>
    <Security />
  </System>
  <EventData>
    <Data>Unable to connect to server '(local)'; SQLServerAgent cannot start</Data>
  </EventData>
</Event>


SQLAgent.out Logfile:

2009-11-06 10:09:52 - ! [298] SQLServer Error: 233, Shared Memory Provider: No process is on the other end of the pipe. [SQLSTATE 08001]
2009-11-06 10:09:52 - ! [298] SQLServer Error: 233, Client unable to establish connection [SQLSTATE 08001]
2009-11-06 10:09:52 - ! [000] Unable to connect to server '(local)'; SQLServerAgent cannot start
2009-11-06 10:09:52 - ! [298] SQLServer Error: 233, Shared Memory Provider: No process is on the other end of the pipe. [SQLSTATE 08001]
2009-11-06 10:09:52 - ! [298] SQLServer Error: 233, Client unable to establish connection [SQLSTATE 08001]
2009-11-06 10:09:52 - ! [382] Logon to server '(local)' failed (DisableAgentXPs)
2009-11-06 10:09:53 - ? [098] SQLServerAgent terminated (normally)

Additional the SQL Server Management Studio is unable to logon to the Server:

TITLE: Connect to Server
------------------------------

Cannot connect to vie-eu-arc-02.

------------------------------
ADDITIONAL INFORMATION:

A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: Shared Memory Provider, error: 0 - No process is on the other end of the pipe.) (Microsoft SQL Server, Error: 233)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=233&LinkId=20476

------------------------------

The local Admin Password was reset to the "original" (after install) one.
Any ideas how to fix the problem?

Unhandle exception

$
0
0

Hi Folks,

I have installed SQL2008 licenced version. after installation i am getting issue while i click SQL Server management studio.

Please find below snapshot for your reference.after i click continue i can go forward one more step. Again it is occur if i click database and Table like. Please give solution to this asap. It will be helpful to me.

 

Backup job failed

$
0
0

Hi All,

One of my production server backup job failed. Please help to resolve this issue.

Executed as user:  Cannot open backup device '    '. Operating system error 32(failed to retrieve text for this error. Reason: 15105). [SQLSTATE 42000] (Error 3201)  BACKUP DATABASE is terminating abnormally.
[SQLSTATE 42000] (Error 3013).  The step failed.

Thanks in advance.....

Official documentation on Infiniband RDMA for AlwaysOn

$
0
0

Hi all,

is there any official documentation (or msdn blog) describing how to implement AlwaysOn with Infiniband and RDMA?

How to insert secific columns using Bulk import concept in sql server without format file?

$
0
0
I wants to insert data into only few columns in my table using bulk insert and to skip some columns , and i dn't wants to use format file, plz help me how to do bulk insert with only few columns in sql server without format file..........

Backup Plan Failure

$
0
0

I have a maintenance plan that backs up all of my databases (around 50).  Recently, the backup job starting failing, and I can't figure out why.  The job output doesn't tell me what is wrong.  It appears that all the databases are being backup up because the backup files are there.

The maintenance plan does the following:

Maintenance Cleanup Task
History Cleanup Task
Database Backup Task
Shrink Database Task
Reorganize Index Task

I think I have plenty of disk space.  Don't know what is wrong.  Job log below:

Date  12/5/2014 12:03:00 AM
Log  Job History (Backup Plan.Backup)

Step ID  1
Server  SHOVELHEAD
Job Name  Backup Plan.Backup
Step Name  Backup
Duration  00:29:20
Sql Severity 0
Sql Message ID 0
Operator Emailed 
Operator Net sent 
Operator Paged 
Retries Attempted 0

Message
Executed as user: ISC\sitemanager. ...on 11.0.2100.60 for 64-bit  Copyright (C) Microsoft Corporation. All rights reserved.    Started:  12:03:00 AM  Progress: 2014-12-05 00:03:01.30     Source: {12063FA7-1B6B-4052-9DC9-5AAF0438D3B7}      Executing query "DECLARE @Guid UNIQUEIDENTIFIER      EXECUTE msdb..sp...".: 100% complete  End Progress  Progress: 2014-12-05 00:03:05.16     Source: Maintenance Cleanup Task      Executing query "EXECUTE master.dbo.xp_delete_file 0,N'D:\Database ...".: 100% complete  End Progress  Progress: 2014-12-05 00:03:05.94     Source: History Cleanup Task      Executing query "declare @dt datetime select @dt = cast(N'2014-11-2...".: 33% complete  End Progress  Progress: 2014-12-05 00:03:05.95     Source: History Cleanup Task      Executing query "EXEC msdb.dbo.sp_purge_jobhistory  @oldest_date='2...".: 66% complete  End Progress  Progress: 2014-12-05 00:03:05.97     Source: History Cleanup Task      Executing query "EXECUTE msdb..sp_maintplan_delete_log null,null,'2...".: 100% complete  End Progress  Progress: 2014-12-05 00:03:06.78     Source: Back Up Database Task      Executing query "EXECUTE master.dbo.xp_create_subdir N'D:\Database ...".: 1% complete  End Progress  Progress: 2014-12-05 00:03:06.78     Source: Back Up Database Task      Executing query "EXECUTE master.dbo.xp_create_subdir N'D:\Database ...".: 3% complete  End Progress  Progress: 2014-12-05 00:03:06.78     Source: Back Up Database Task      Executing query "EXECUTE master.dbo.xp_create_subdir N'D:\Database ...".: 4% complete  End Progress  Progress: 2014-12-05 00:03:06.78     Source: Back Up Database Task      Executing query "EXECUTE master.dbo.xp_create_subdir N'D:\Database ...".: 6% complete  End Progress  Progress: 2014-12-05 00:03:06.78     Source: Back Up Database Task      Executing query "EXECUTE master.dbo.xp_create_subdir N'D:\Database ...".: 7% complete  End Progress  Progress: 2014-12-05 00:03:06.78     Source: Back Up Database Task      Executing query "EXECUTE master.dbo.xp_create_subdir N'D:\Database ...".: 9% complete  End Progress  Progress: 2014-12-05 00:03:06.78     Source: Back Up Database Task      Executing query "EXECUTE master.dbo.xp_create_subdir N'D:\Database ...".: 10% complete  End Progress  Progress: 2014-12-05 00:03:06.78     Source: Back Up Database Task      Executing query "EXECUTE master.dbo.xp_create_subdir N'D:\Database ...".: 12% complete  End Progress  Progress: 2014-12-05 00:03:06.78     Source: Back Up Database Task      Executing query "EXECUTE master.dbo.xp_create_subdir N'D:\Database ...".: 13% complete  End Progress  Progress: 2014-12-05 00:03:06.78     Source: Back Up Database Task      Executing query "EXECUTE master.dbo.xp_create_subdir N'D:\Database ...".: 15% complete  End Progress  Progress: 2014-12-05 00:03:06.78     Source: Back Up Database Task      Executing query "EXECUTE master.dbo.xp_create_subdir N'D:\Database ...".: 16% complete  End Progress  Progress: 2014-12-05 00:03:06.80     Source: Back Up Database Task      Executing query "EXECUTE master.dbo.xp_create_subdir N'D:\Database ...".: 18% complete  End Progress  Progress: 2014-12-05 00:03:06.80     Source: Back Up Database Task      Executing query "EXECUTE master.dbo.xp_create_subdir N'D:\Database ...".: 20% complete  End Progress  Progress: 2014-12-05 00:03:06.80     Source: Back Up Database Task      Executing query "EXECUTE master.dbo.xp_create_subdir N'D:\Database ...".: 21% complete  End Progress  Progress: 2014-12-05 00:03:06.80     Source: Back Up Database Task      Executing query "EXECUTE master.dbo.xp_create_subdir N'D:\Database ...".: 23% complete  End Progress  Progress: 2014-12-05 00:03:06.80     Source: Back Up Database Task      Executing query "EXECUTE master.dbo.xp_create_subdir N'D:\Database ...".: 24% complete  End Progress  Progress: 2014-12-05 00:03:06.80     Source: Back Up Database Task      Executing query "EXECUTE master.dbo.xp_create_subdir N'D...  The package execution fa...  The step failed.


dave

How Can We Read .txt File With Blanks ("Bulk load: An unexpected end of file was encountered in the data file" Error)

$
0
0

Hi;

I have a problem about reading .txt file from sql stored procedure. 

Everyday an application automatically export a .txt file into a folder in the server.

If i delete the blanks in the end of file the procedure works very well and i can import the content of .txt into T_TABLE.

But if i don't do it i take this error;

"Msg 4832, Level 16, State 1, Procedure Import_Data, Line 36
Bulk load: An unexpected end of file was encountered in the data file.

I have to say this, i have no chance to delete these blanks in the end of file every day, and like i said it is being exported automatically.

Please help me, how i can solve this error? My procedure is below;


USE [TEST_DATABASE]

GO
/****** Object:  StoredProcedure [dbo].[Import_Data]    Script Date: 12/05/2014 12:23:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[Import_Adherence]
AS 


BEGIN
SET NOCOUNT ON;
IF OBJECT_ID('TEMPDB..#TempTable') IS NULL
BEGIN 

CREATE TABLE #TempTable ([date] nvarchar(max) NULL,  [TZ] nvarchar(max) NULL,  [custID] nvarchar(max) NULL)

BULK INSERT #TempTable FROM 'C:\Users\cy\Desktop\test\data.txt' 
WITH 
(
 ROWTERMINATOR = '\n',
 FIELDTERMINATOR = '|',
 FIRSTROW = 4
)
END

INSERT INTO T_TABLE ([date], [TZ], [custID])
SELECT [date], [TZ], [custID] FROM #TempTable;

END 

                                                                                       

 

You can see what i meaned with the blanks in the end of file.


Best procedure to downgrade a SQL Server 2012 SP2 installation from Enterprise edition to Standard edition

$
0
0

Hi,

following a purpose change for a database server, I need to downgrade the SQL Server 2012 SP 2 installation from Enterprise to Standard edition.

Does it exist the best procedure to do it in a secure manner with a low impact?

Many thanks

Use of SQL Server 2012 Development on my TEST SERVER

$
0
0

Can we install on a new TEST server Sql 2012 Developer for the 6+ instances that mirror our Prod box? 

There is nothing on this server that is hit directly in any aspect of company systems.  It is 100% mirror to my 12 Prod server in folders and content for testing our ERP system tweaks and updates before they are deployed on Prod.

  

The PROD box will be SQL Enterprise 2012.  This we hope can alleviate the intense fees for licenses on TEST.

Are there any problems with this legal as well as functional?

TIA

Stephen Russell

Sr. Analyst

 

Disk space information using t-SQL

$
0
0

Actually I am looking for a sql script which can give all the disk space information on the server including disk free space percent and if the disk free space percent is less than 10%, it needs to be highlighted in red color. And all this information needs to be sent out in a email in HTML table format. Any ideas?

Thanks.


sqldev

Viewing all 12963 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>