Quantcast
Channel: SQL Server Data Access forum
Viewing all 4164 articles
Browse latest View live

Need a query2

$
0
0

Input:

RID     date

01     2012-04-01

02     2011-12-01

03     2007-10-12

---

Output   

RID     date

01     2011-05-01

03     2008-10-14

07     2010-02-12

--

i need a query to return rows that (output.date>input.date for each RID)  or (RID not in input table)

Result:

RID   date

03     2008-10-14

07     2010-02-12


DPM Database Restore issue

$
0
0

Hi All,

I did A DPM server upgrade from 2008 to 2012 R2 and I freshly installed DPM on it now but when I try to restore the back up to the 2008 R2 database i am getting the following error - 

C:\Program Files\Microsoft System Center 2012 R2\DPM\DPM\bin>DpmSync -restoredb
-dbloc C:\DPM Old backup\DPMDB.bak
DpmSync 2.0 - DPM database synchronization command-line tool
Copyright (c) 2013 Microsoft Corporation. All rights reserved.

Error ID: 4311
SQL Server Management tools not installed on this machine.
1) Please install SQL 2012 Service Pack 1 Tools from installation media.
2) For more details about SQL Server 2012 Service Pack 1 tools go to http://go.m
icrosoft.com/fwlink/?LinkId=313283.

How do i resolve this

MSDTC Failure - Enlist operation failed: 0x8004d01c(XACT_E_CONNECTION_DOWN).

$
0
0

Hi,

We had to recycle MSDTC for some other reason and noticed that all transactions started failing with the below error.

Enlist operation failed: 0x8004d01c(XACT_E_CONNECTION_DOWN). SQL Server could not register with Microsoft Distributed Transaction Coordinator (MS DTC) as a resource manager for this transaction. The transaction may have been stopped by the client or the resource manager.

All these transactions were going through fine until we recycled the dtc service. We noticed in some forums that the only solution is to restart sql server service.

Curious to know -

  • What is the sql server registration process with MSDTC and what could cause this to fail?
  • Any other resolution other restarting the services ?
  • Any proactive measures to avoid this failure?


Trinity

An error has occurred during report processing. Cannot create a connection to data source

$
0
0

I'm using vs2013, and the report that comes with it, against MS SQL'08R2.

The question I have is how do I debug the report data request -> data environment -> SQL pathway and find the broken bit.

I'm trying to track down the source of the following message, since the query that is being referenced works fine when executed against the database:

  • An error has occurred during report processing.
    • Cannot create a connection to data source 'PDT'.
      • Exception has been thrown by the target of an invocation.
        • Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.

UPDATE failed because the following SET options have incorrect settings:

$
0
0

Hi

I have a VFP app that has been running happily for some time, talking to SQL Server using SQL-Passthrough.

SQL Server was recently updated and now the link is broken.  Specifically, I get this error:

[Microsoft][SQL Server Native Client 10.0][SQL Server]UPDATE failed because the following SET options have incorrect settings: 'ANSI_NULLS, QUOTED_IDENTIFIER, CONCAT_NULL_YIELDS_NULL, ANSI_WARNINGS, ANSI_PADDING'. Verify that SET options are correct for use with indexed views and/or indexes on computed columns and/or filtered indexes and/or query notifications and/or XML data type methods and/or spatial index operations.

These are all set as follows at the database level in SQL Server:

SET ANSI_NULLS ON

SET ANSI_PADDING ON

SET ANSI_WARNINGS ON

SET ARITHABORT ON

SET CONCAT_NULL_YIELDS_NULL ON

SET NUMERIC_ROUNDABORT ON

SET QUOTED_IDENTIFIER ON

It seems that the connection properties are somehow overriding that - but not being a SQL Server guru I'm not sure.  IS that the problem ?

Is it possible to specify these settings in the connect string, or otherwise ?

Any advice appreciated.


Brian Abbott

Error when creating a database on SQL Server 2012(Virtual Machine)

$
0
0

Hi,

 

I create a virtual machine on VMWare Workstation 10, then install Windows 7(32bit), then install SQL Server 2012 Enterprise version.

 

Then I write a Visual C++2008 program and using ADO to connect to the local SQL Server, with the connection string below:

 

“Provider=sqloledb;Data Source=(local);Integrated Security=SSPI;”

 

The connect succeed, then I try to create a new SQL Server database by calling:

 

m_pConnection->Execute(_T(“create database MyDatabase on primary (name = ‘MyDatabase’, filename = ‘E:\\MyDatabase.mdf’)”), NULL, 0);

 

where E: is a USB drive plugged in.

 

When running the above statement, I can even see the MyDatabase.mdf file is being created, but finally get an error and error number is 80040e31 when checking the error from m_pConnection, after analyzing the com exception, we find it reports the error as“IDispath error #3121”. Both errors seem to indicate a “Timeout error”.

 

Then I try to create the database on the local drive in the virtual machine, as follows:

 

m_pConnection->Execute(_T(“create database MyDatabase on primary (name = ‘MyDatabase’, filename = ‘C:\\MyDatabase.mdf’)”), NULL, 0);

 

Then I get error number: 80040e14 from m_pConnection, and com error is “IDispath error #3092”

 

What is the problem?

 

Thanks

CRecordset::Open raise exception when the table has large amout of records

$
0
0

Hi All,

In my application, using CRecordSet to handle the SQL Server data access, and when the record in the table was less than 1Million, there was not problem.

but when the records are more than 1 million, the CRecordSet::Open will raise exception.

as:

ChildEBP RetAddr Args to Child 13beea40 7773319f 00000001 6cdd0000 00000000 ntdll!RtlImageNtHeaderEx+0xba (FPO: [SEH]) 13beea60 777419de 6cdd0000 643e3ea3 6cdd0000 ntdll!RtlImageNtHeader+0x1b (FPO: [1,1,0]) 13beeaa0 7774197e 6cdd0000 00000000 00000000 ntdll!LdrpGetFromMUIMemCache+0x42 (FPO: [SEH]) 13beead0 7774190e 6cdd0000 00000000 00000001 ntdll!LdrpGetRcConfig+0x21 (FPO: [4,4,0]) 13beeaf0 7774178e 6cdd0000 13beebc4 00000003 ntdll!LdrIsResItemExist+0x19 (FPO: [4,1,4]) 13beeb98 77755655 6cdd0000 13beebc4 00000003 ntdll!LdrpSearchResourceSection_U+0xc9 (FPO: [SEH]) 13beec00 768d4aa2 6cdd0000 000000ef 00000000 ntdll!RtlLoadString+0x10e (FPO: [SEH]) 13beec3c 76928ed2 6cdd0000 000000ef 01563d6c KERNELBASE!LoadStringBaseExW+0x51 (FPO: [5,3,0]) 13beec58 6dda59ed 6cdd0000 000000ef 01563d6c USER32!LoadStringW+0x19 (FPO: [4,0,0]) 13beec70 6dda6686 015633b8 015633b0 00000000 ODBC32!StringCbCopyNW+0x276 (FPO: [0,0,4]) 13beec88 6dda6e0f 015633b8 13bef224 015633b0 ODBC32!PostErrorArg+0x518 (FPO: [1,2,0]) 13beecfc 6dda7611 015633b0 0155eed8 13beed18 ODBC32!PostErrorArg+0xcc0 (FPO: [0,23,4]) 13beed28 6dda7bd4 015633b0 13beedb0 13beedc0 ODBC32!SQLGetDiagRecW+0x524 (FPO: [5,7,0]) 13beed54 6f4b296e 0155eed8 01562e30 00000000 ODBC32!SQLErrorW+0x10d (FPO: [8,1,4]) 13bef240 6f4b3df8 01480680 015633b0 00000000 mfc90u!CDBException::BuildErrorString+0x89 (CONV: thiscall) [f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\dbcore.cpp @ 144] 13bef264 6f4b3aad b92feeff 13bef41c 13bef624 mfc90u!CRecordset::IsOpen+0x6d (CONV: thiscall) [f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\dbcore.cpp @ 1258] 13bef298 0fbe405f 00000001 00000000 00000000 mfc90u!CRecordset::Open+0x16 (CONV: thiscall) [f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\dbcore.cpp @ 1072] 13bef384 0fbe78c9 13bef41c 13bef624 00000003 XXXODBC!CLogManager::OpenDBForRead+0x35f (FPO: [Non-Fpo]) (CONV: thiscall)

13bef418 7516592c 01462680 00000804 00d8743c XXXODBC!CODBCAdaptor::ReadMessages+0xb9 (FPO: [Non-Fpo]) (CONV: stdcall)

13bef440 751e05f1 0fbe7810 13bef628 00000005 RPCRT4!Invoke+0x2a

Then after CRecordset::IsOPen return, will runinto PrepareAndExecute

t

ChildEBP RetAddr  Args to Child              
13befb10 7515383b 80010105 00000001 00000000 KERNELBASE!RaiseException+0x58 (FPO: [4,20,0])
13befb2c 7559a4b8 80010105 00d8d1c0 00000000 RPCRT4!RpcpRaiseException+0x7b (FPO: [1,0,4])
13befb74 75165eba 00d949e8 b9e39c6e 00d8d1c0 ole32!ThreadInvoke+0xb7 (FPO: [Non-Fpo]) (CONV: stdcall) [d:\w7rtm\com\ole32\com\dcomrem\channelb.cxx @ 4671]
13befbac 7516624c 7559df76 00d949e8 13befc90 RPCRT4!DispatchToStubInCNoAvrf+0x46 (FPO: [SEH])
13befc04 751667f5 00000000 00000000 00000000 RPCRT4!RPC_INTERFACE::DispatchToStubWorker+0x141 (FPO: [4,14,4])
13befc28 75166796 00d949e8 00000000 00000000 RPCRT4!RPC_INTERFACE::DispatchToStub+0x90 (FPO: [4,0,4])
13befc64 751666b1 00d949e8 00d94a4c 00000000 RPCRT4!RPC_INTERFACE::DispatchToStubWithObject+0xbc (FPO: [5,6,4])
13befcb0 751665c3 13befcc8 00000000 00dfdd80 RPCRT4!LRPC_SCALL::DispatchRequest+0x214 (FPO: [1,9,4])
13befcd0 75166581 00d94930 00dfdda8 00ddb528 RPCRT4!LRPC_SCALL::QueueOrDispatchCall+0xc7 (FPO: [0,2,4])
13befcec 75166425 00dfdd80 00d8d1c0 00000000 RPCRT4!LRPC_SCALL::HandleRequest+0x305 (FPO: [4,2,4])
13befd1c 75166398 00dfdd80 00ded878 00000000 RPCRT4!LRPC_SASSOCIATION::HandleRequest+0x153 (FPO: [5,3,4])
13befd50 75164abf 00dfdd80 13befd90 00ded878 RPCRT4!LRPC_ADDRESS::HandleRequest+0xc4 (FPO: [4,3,4])
13befddc 751649ac 00000000 13befdf8 7516480f RPCRT4!LRPC_ADDRESS::ProcessIO+0x44c (FPO: [1,24,0])
13befde8 7516480f 00d8d374 00000000 13befe20 RPCRT4!LrpcServerIoHandler+0x16 (FPO: [2,0,0])
13befdf8 77764766 13befe64 00d8d374 00d98d68 RPCRT4!LrpcIoComplete+0x16 (FPO: [4,0,0])
13befe20 7775341f 13befe64 00000000 00000000 ntdll!TppAlpcpExecuteCallback+0x1c5 (FPO: [4,1,4])
13beff88 74e833aa 00d65f10 13beffd4 77739ef2 ntdll!TppWorkerThread+0x5a4 (FPO: [SEH])
13beff94 77739ef2 00d65f10 643e2bd7 00000000 kernel32!BaseThreadInitThunk+0xe (FPO: [1,0,0])
13beffd4 77739ec5 77753e45 00d65f10 00000000 ntdll!__RtlUserThreadStart+0x70 (FPO: [SEH])
13beffec 00000000 77753e45 00d65f10 00000000 ntdll!_RtlUserThreadStart+0x1b (FPO: [2,2,0])

(518.178c): C++ EH exception - code e06d7363 (first chance)
(518.178c): C++ EH exception - code e06d7363 (first chance)
(518.178c): Unknown exception - code 80010105 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
eax=0271fac0 ebx=00000000 ecx=00000000 edx=0030b434 esi=80010105 edi=766c7430
eip=74d9c41f esp=0271fac0 ebp=0271fb10 iopl=0         nv up ei pl zr na pe nc
cs=0023  ss=002b  ds=002b  es=002b  fs=0053  gs=002b             efl=00000246
KERNELBASE!RaiseException+0x58:

Is there any limitations about CRecordSet? Or anything need to take care when using this class?

To solve this issue anything else needed I should provide?

Sorry for I'm very new for DB programming.

Thanks,Levi


One world, one dream




Cannot connect to SQL Server 2008 Express

$
0
0

I install SQL Server 2008 Express on Windows 7 and make sure SQL Server(SQLEXPRESS) service is running. Then I write a program via Visual C++ & ADO, and try to connect to the local SQL Service instance by using the following SQL connection string:

“Provider=sqloledb;Data Source=(local);Integrated Security=SSPI;”

But the connection fails. I try the same code on a computer with SQL Server 2008 Professional installed and it works without problems.

Please advise. Thanks.


SLOWDOWN AT THE SAME TIME EACH DAY

$
0
0
My client has a sql server 2008 r2 installed for several years now.  I have an access 2003 frontend which has been working fine for many years.  For about 2 weeks now between 10 am and 11 am there has been a huge slowdown.  I have run spwho3 and see no conflicts.  If I kick all users out of the system and do an index rebuild then there is no problem for the rest of the day.  I am not doing any sql backups during that time.  The network manager says that they are not doing any backups or virus scans at that time.   It's very frustrating.  Please advise with what I can look for or test to resolve this problem.  Sorry  if I'm not addressing the correct forum.  Once before this was occurring when the server administrator was running backups of the server and this problem started just after they were in working on the server.  But, of course, the finger is being pointed at the program.

[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied.

$
0
0

 

I have a app created using VS 2005 with SQL 2005.  I upgrade to VS 2008 but didn't deploy because there were no changes requested.  I got a request last week and made the changes. On my development machine everything worked fine.  I did the release of all the pages and the .dlls so all the upgraded code was there.  Now the user can log in and get to a reporting section but when they go to export the report into excel we get this error

 

[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied.

 

It seems to error using the same connection that the user used to get into the app so I don't know why now its being denied.  I'm using adodb.dll to connect this time.

 

Thank you for any help.  Let me know if I didn't put enough information.

 

 

 

SQL services use 100% Harddisk when queries

$
0
0
I developed  my own app to query the data from MSSQL

I use MSSQL 2008 R2

when I run the query in MSSMS, it's work fine and has very fast response

but when I run with C# application (integrated query inside).

it take about 5000ms for 1 query and when I exterminate the task manager, I found that the services of my database engine using disk load about 5-7 MB/s (but the % is 100%)  

after some experiment. I found out that if I want to make the query faster in my C# app, I have to open the MSSMS "together" (and make any select top 1000) with my query in C# app

anyone know what is MSSMS do to increase the performance of any running services?


**Note that it happens only some PC not all of them. 

ODBC driver install says requires unixODBC 2.3.0, but I have 2.3.1 installed

$
0
0

I'm trying to install the ODBC driver according the instructions here http://technet.microsoft.com/en-us/library/hh568454.aspx but when I do ./install.sh verify it fails and write this to the log:

[Thu Jul 18 10:28:22 EDT 2013] Verifying that unixODBC is version 2.3.0
[Thu Jul 18 10:28:22 EDT 2013] unixODBC version must be 2.3.0 . See README for more information.

I have 2.3.1 of unixODBC installed.  Is there a way to change the requirement in this verify process so that 2.3.1 passes the test and the install can continue?


JDBC driver/bridge on maven central repository or Microsoft maven repository ?

$
0
0

HI 

why there is no JDBC bridge/driver for SQL Server on the maven repository yet? Even if the dll cannot be deployed directly along with the jars, the access to the jars can be very useful while testing.

Moreover if there is no chance to publish the jars on the central repository, it can be useful to have access on a Microsoft maven repository.

Is it possible to redistribute the jars for publishing it indipendently?

Thanks in advance for any help/suggestions

Alfredo

SQL services use 100% Harddisk when queries

$
0
0
http://social.msdn.microsoft.com/Forums/sqlserver/en-US/f092e40b-7879-47b9-9af8-b43ff1d7c0b1/sql-services-use-100-harddisk-when-queries?forum=sqlintegrationservices

SQL Server 2008:hide any row associate with original ticket when Status is cancel

$
0
0

How can I say to hide any "original ticket" when the column status is Cancel?

Date Date Stamp Original Ticket Trade Number Status---- ---------- --------------- ------------ ------01 jan 01 jan 123130 Modify01 jan 02 jan 123140 Cancel03 jan 03 jan 145150 Modify04 jan 04 jan 160200 Cancel

05 jan 05 janv 210 210 (empty because some trade are not modify)

i wanna get this result: hide original ticket witch status are cancel

Date Date Stamp Original Ticket Trade Number Status---- ---------- --------------- ------------ ------03 jan 03 jan 145150 Modify

05 jan 05 janv 210 210

Tks a lot


increment primary key and reset every year

$
0
0

Hi

I am developing asp.net application
with sql server database

I have table FinancialYear

caseno(unique)  finyear
1           2013-2014
2           2013-2014   
3           2013-2014 
1            2012-2013
2           2012-2013
3           2012-2013   



For financial year-2013 to 2014. if i insert record ( select max(caseno) +1).

insert into finanancialYear values(max(caseno) +1,2013-2014)

if i delete record caseno:3  from the table,

   select max(caseno)+1 will be 3  
which is already deleted and again that record with caseno 3 will be inserted

How  to solve the issue.

for every financial year in 'FinancialYear' table,.caseno will be reset to 1
 and if i add new record in finyear 2012-1013 
then max(caseno) will be last value of caseno of that financial year 2012-2013
Again insert becomes
insert into finanancialYear values(max(caseno) +1,2012-2013)

i have given the data  .Please help me.




Thanks

Chandran.

  

Connection failed SQL State '01000' SQL Server Error:5

$
0
0

I get attached screenshot error when I ceate new ODBC connection from cleint windows 7 machine to SQL server 2012 database

I have tested same credntial locally on server works fine it is only client machine cannot connect.


Muhammad Mehdi

to insert mathematical and chemical formula in SQL2005 databse

$
0
0
i want to  insert mathematical and chemical formula in SQL server database 2005 using xls file and want to retrive it on webpage using asp.netwith c#.iam able to insert other data into database but in place of chemical and mathematical formula its showing null  and i am unable to retrive it also so please help me how to short out this problem

ODBC vs PDO/DBLib with unix (Benchmark)

$
0
0
Can you tell me please which is the best one between ODBC and DBLib. I need an answer with some details (which faster, which...). Thank you

ODBC Connection failed to SQL2008 R2

$
0
0

We replaced our SQL Server with new hardware and went from using SQL 2005 to 2008R2. We are trying to setup a Windows 7 ODBC connection to SQL Server 2008R2. This workstation previously used the ODBC connection to SQL 2005, and we are using the same SQL Native Client driver to try to connect the new SQL 2008R2 Server. We get this error after supply SQL credentials:

Do we need to update the SQL Native Client -if, where do we find that? Thank you!

Viewing all 4164 articles
Browse latest View live