Stored Procedures, is this still encouraged?
Linked Server to Access database 7303 error, works from server but not from workstation
Hello, we have a SQL 2012 server trying to make a linked server to an Access 2010 database on a separate server. From the server, I can make a linked server that works using SSMS on the SQL server itself. However if I then try to access it using a workstation, I receive an error:
---
Failed to retrieve data for this request. (Microsoft.SQLServer.Management.Sdk.SFC0
An exception occurred while executing a Transact SQL Statement or batch.
(Microsoft.SqlServer.ConnectionInfo)
Cannot initialize the data source object of OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "SURVEY_UTILITY_ACCESS". (Microsoft SQL Server, Error: 7303)
--
I've checked the various make sure the temp folder has write access, and that inprocess is checked for the provider, but since it works at the server neither seemed likely. So I moved the database to the SQL server itself. I created a new linked server, and it works fine. So it appears going from SQL to file server works, or going from workstation to SQL only works. It appears there must be something when one goes from workstation->SQL->file server that causes this problem. Has anyone encountered this? Thanks in advance.
Snapshot isolation transaction aborted
Q: Does 'Snapshot isolation transaction' happens on row conflict only?
or Snapshot does as a page and conlift occurs any of record on such Page may cause this issue?
We are sure that none of two transactions are updating same row / record.
Yes, application run as multi thread env//calls
but, as per code and SQL Profiled / as per logs, there is no parrellel/ duplicate request made for same record
There is no trigger/procedure - none of records are holding across these sessions
-----------
Yes, conlfict is possible on same table but on the diffrent record..
We analysed SQL profiler.. Updated record on Row A vs Delete record on Row B
-----------
------------
So, quetion is... below snapshot error happens on Table(page)? or only one a row?
-------
but still we are getting snapshot error as below
Caused by: org.hibernate.exception.SQLGrammarException: could not execute update queryat org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:90)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at org.hibernate.hql.ast.exec.BasicExecutor.execute(BasicExecutor.java:109)
at org.hibernate.hql.ast.QueryTranslatorImpl.executeUpdate(QueryTranslatorImpl.java:422)
at org.hibernate.engine.query.HQLQueryPlan.performExecuteUpdate(HQLQueryPlan.java:283)
at org.hibernate.impl.SessionImpl.executeUpdate(SessionImpl.java:1212)
at org.hibernate.impl.QueryImpl.executeUpdate(QueryImpl.java:117)
at com.artesia.server.security.session.entity.SecuritySessionStorageManager.removeClientSession(SecuritySessionStorageManager.java:232)
... 68 more
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Snapshot isolation transaction aborted due to update conflict. You cannot use snapshot isolation to access table 'dam_mm_stg.CLIENT_SESSIONS' directly or indirectly in database 'DAM_MM_STG' to update, delete, or insert the row that has been modified or deleted by another transaction. Retry the transaction or change the isolation level for the update/delete statement.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:156)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1373)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:371)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:322)
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:4003)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1550)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:160)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:133)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeUpdate(SQLServerPreparedStatement.java:290)
at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:365)
at org.hibernate.hql.ast.exec.BasicExecutor.execute(BasicExecutor.java:100)
... 73 more
How do you allow SQL Server 2014 Express for remote connection and in firewall?
I'm sorry if this was answered here before.
I installed SQL Server 2014 Express and it is working perfectly. I want my server to be accessed through LAN. It is a named instance.
I searched the internet and here's what i did:
1. Through the SQL Configuration manager, I enabled all the Protocols of my Instance (TCP/IP, Named Pipes and Shared Memory). I changed in the IP Addresses the "IP ALL" TCP Dynamic Ports to 1434.
2. In the Firewall I made an Inbound Rule to allow the Program (%ProgramFiles% (x86)\Microsoft SQL Server\MSSQL12.MyInstance\MSSQL\Binn\sqlservr.exe)
3. I also made 2 Inbound Rules to allow (TCP/IP Port 1433) and (UDP Port 1434).
4. Restarted my instance. SQL Server Browser and SQL Server Reporting Services are also running.
5. No Luck I cant still access the server using a different computer in the network.
Please help.
linked Server Issues...
OLE DB provider "SQLNCLI11" for linked server "Server-A" returned message "No transaction is active.".
Msg 7391, Level 16, State 2, Line 3
The operation could not be performed because OLE DB provider "SQLNCLI11" for linked server "Server-A" was unable to begin a distributed transaction.
is it due to SQL server version mismatch ?? or due to any other issues ??
version of the 2 linked sql server is:
Server1:
Microsoft SQL Server 2005 - 9.00.3215.00 (X64) Dec 8 2007 17:58:16 Copyright (c) 1988-2005 Microsoft Corporation Enterprise Edition (64-bit) onWindows NT 5.2 (Build 3790: Service Pack 2)
Server2:
Microsoft SQL Server 2005 - 9.00.3215.00 (X64) Dec 8 2007 17:58:16 Copyright (c) 1988-2005 Microsoft Corporation Enterprise Edition (64-bit) onWindows NT 6.1 (Build 7601: Service Pack 1)
Please revert me as soon as possible.....
How to track database change history
Encrypt the SQL query
Hi,
In my Visual C++ program, I will use ADO to connect to SQL Server and execute SQL queries. But these queries are just stored as normal string constants in Visual C++ so it is easy to be decoded via reverse engineering method. Does SQL Server provide a good way to encrypt the SQL query strings while does not affect the performance when executing the queries?
Thanks
Deleted email
Im hopping you can help me , by accident I deleted all my emails of over 10 years from my Inbox . I was cleaning the junk and deleted emails and it moved to the inbox folder and I deleted
I wonder if there is a way to get it back .
It will be great to recover them
Thanks in advance
stored procedures
My output like this....
select * from tab_patient where regdate >= '02/01/2016' and regdate <= '02/29/2016' and pname like '%g%' and sex = 'male' and mob1 = '0'
Pls create stored procedure for above query with only one parameter.
Pass only one parameter including all columns....
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[Pro_allrep]
@strall varchar(MAX)
AS
BEGIN
select * from tab_patient where regdate >= @strall
END
@strall = '02/01/2016' and regdate <= '02/29/2016' and pname like '%g%' and sex = 'male' and mob1 = '0'
@strall values passed from from end.
date value from date time picker, pname value from textbox1, sex value from combo box and mob1 from textbox2.
how do i write code from front end.
Nithiyanantham
error when selecting a row in the table
Hi
I can read the data out of the table ok....and place it in a datatable object. The problem is with the command to find/select the row in this datatable that I am looking for. Code is below....
# Create SqlConnection object, define connection string, and open connection
$con = New-Object System.Data.SqlClient.SqlConnection
$con.ConnectionString = "Server=serpens\prod_inst1; Database=HWRManager; Integrated Security=true"
$con.Open()
# Define the SELECT statement and create the SqlDataAdapter object
$cmdSelect = "SELECT * FROM HWR_STAFF_ASSIGNMENT"
$da = New-Object System.Data.SqlClient.SqlDataAdapter($cmdSelect, $con)
# Create and fill DataTable object
#$dt = $ds.Tables["Inventory"]
$dt = New-Object System.Data.DataTable
$da.Fill($dt) | Out-Null
# update row in dataset
$isw_AssignmentCode = "TestAs"
$updateRow = $dt.Select("isw_AssignmentCode = $isw_AssignmentCode") #this line causes the error...see error below
$updateRow[0].isw_AssignmentText = "Changed"
The 2nd last line causes the following error....
Exception calling "Select" with "1" argument(s): "Cannot find column [TestAs]."
At W:\autoproject\update.ps1:23 char:1
+ $updateRow = $dt.Select("isw_AssignmentCode = $isw_AssignmentCode")
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : EvaluateException
Testas is a value/string in that column I want to look for and return the row it is in...so I can eventually update that row.
If anyone can shine some light on this...it would be appreciated. Thx.
how to get data from select query
Hi
I have table
CLELSL | CL EL CL
Opening |834 8
0.5 0.00.0 | 7.5 (8-0.5) 34 8
1.00.03 | 6.5(7.5-1) 34 5(8-3)
I have opening values
CL=8
EL=34
CL=8
I am subtracting opening values with first 3 column values and display in last 3 columns
Please help me to get solution.
Thanks and regards
N.Ramachandran
Connecting SQL Server from Android Apps in Mobile
Hi all,
I've created an Android application in Monodroid and connected to SQL Server to fetch data from the tables created.Everything is working fine.
Now, I've converted the same to APK format, put the same into my android phone, installed the application in my mobile. Now, I need to access my sql server.
Please tell me the procedure, How i can connect to my sql server in the LAN with my Android Mobile.
Cheers,
Venkat
Venkatesan Prabu .J www.kaashivinfotech.com http://venkattechnicalblog.blogspot.com/
Download Location of SQL Server 2008 R2 Native Client
Hi,
I am trying to find the download location of SQL Server 2008 R2 Native Client. I can find R1 and R3 but not R2. Can someone provide me the location to the sqlcli.msi for this release or do I have to use the full version of SQL Server to extract it?
Thanks,
Mike Myers
unlock sa user in sql
display date and day
display particular day and date that falls between two dates .
Plz anser to this question
Connecting to SSMS from Azure
Working on a continuation project that was not properly documented. We currently have data stored on azure, and for testing purposes want to be able to view it in SQL server. We easily found the server name on Azure. However, we cannot login and when using the login/password for the overall azure account we receive this error:
TITLE: Connect to Server
------------------------------
Cannot connect to -----------.database.windows.net.
------------------------------
ADDITIONAL INFORMATION:
Cannot open server "habitattuscaloosa.org" requested by the login. The login failed. (Microsoft SQL Server, Error: 40532)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&EvtSrc=MSSQLServer&EvtID=40532&LinkId=20476
We believe we can't find the correct login and password. Another forum suggested this login and password were different than the general login but if so, the prior team did not record this information. Where would we go to change the username and password so we can connect?
Thank you!
SQL_Variant datatype Binding as Output parameter in stored procedure using ODBC
Hi,
Need help to find how to bind sql_variant datatype as output paramater in stored procedure using SQLBindParameter API.
I hve already tried binding using its respective C datatype which is SQL_SS_VARIANT. SQLBindParameter doesn't give error but while looping through SQLMoreResults an error is observed "An error encountered: SQLState = HY000, NativeError: 0, ErrorMessage: [Microsoft][ODBC Driver 11 for SQL Server]Protocol error in TDS stream". This error is received only in case of SQL_Variant and no other datatype. At the same time, I tried the same code logic with Native Client driver and it worked fine without any errors.
I have already refereed MSDN blogs for SQL_Variant and a number of tech samples. But no luck.
Thanks in advance.
Shivani
SQLBindParameter with Geography
I'm trying to insert a Geography datatype through ODBC. I have no trouble getting it out as a Blob but if I try to get it out as a Geography with STGeomFromWKB it fails. When It goes to run SQLExecute, it doesn't see that I have a SQL_NEED_DATA it just returns the following error. I have been looking and looking for advise and have yet to find any.
I am binding with a SQL_C_BINARY.
● Output (3): Internal Error in SQLExecute: [Microsoft][SQL Server Native Client 10.0]Parameter information is missing from a user-defined type. Insert into "Test1"("LineNumber","Zip_Point") Values (?,geography:TGeomFromWKB(?,4326))
Issues in binding geography type of output parameter of stored procedure with ODBC
Hello,
I have a SP with a geography type of parameter as input/output type. I am using SQLBindParameter ODBC API to bind the parameter like below,
retcode = CheckforError(
SQLBindParameter(
m_hStmt,//handle
i + 1,//Param number
2,//Parameter type
SQL_C_BINARY,//CDatattype
SQL_C_BINARY,//SQL datatype
79,//Column size
0,//Decimal digits
cdata,//buffer to store data
79,//bufferLength
pLenIndicator), SQL_HANDLE_STMT, errorStr);//strlen
It throws an error - "Implicit conversion from data type geography to binary is not allowed. Use the CONVERT function to run this query.".
When I verified the SQL profiler query being fired by my application, query is -
declare @p1 binary(79)
set @p1=0xE610000001148716D9CEF7D34740D7A3703D0A975EC08716D9CEF7D34740CBA145B6F3955EC00000000000000000000000000000000000000000000000000000000000000000000000000000000000
exec [SPInOutGeography_ODBC] @p1 output,4
select @p1
I think issue is, somehow ODBC should understand that @p1 is of Geography type and not the binary type.
If anyone can help me identifying right approach..