sql-server-2005

SQL Exception: "Impersonate Session Security Context" cannot be called in this batch because a simultaneous batch has called it

When opening a connection to SQL Server 2005 from our web app, we occasionally see this error: "Impersonate Session Security Context" cannot be called in this batch because a simultaneous batch has called it. We use MARS and connection pooling. The exception originates from the following piece of code: protected SqlConnection Open()...

C++ Access to SQL Server from Linux

I need to write some data to SQL Server database from Linux in C++. I found this sqlapi.com But I think, at first ODBC driver has to be installed and has to work. I folowed this adminlife.net/allgemein/mssql-zugriff-unter-debian-etch-mit-unixodbc-und-freetds/ or this http://b.gil.megiteam.pl/2009/11/linux-odbc-to-mssql/ But it didn't...

Skipping one item in the column

I created a simple news website. I store both videos and images in IMAGES table. Videos added have videos and images added have images stored in a column called ImagesType. Images and Videos attached to a news is stored in ImagesID column of the NEWS table. My problem occurs when I need to display the first image of a news. i.e. IMAGES...

What is the suggested approach to Syncing/Backing up/Restoring from SQL Server 2008 to SQL Server 2005

I only have SQL Server 2008 (Dev Edition) on my development machine I only have SQL Server 2005 available with my hosting company (and I don't have direct connection access to this database) I'm just wondering what the best approach is for: Getting the initlal DB Structure & Data into production. And keeping any structural changes/da...

SQL 2005 - SSL Security error at connection

A client of mine has an application that is being migrated from SQL 2000 to SQL 2005. After the DB migration, the following error is occurring when the application tries to execute a SQL query. xSomeClassTools: 3/30/2010 9:27:42 AM-ErrorMessage:SSL Security error.- StackTrace: at System.Data.SqlClient.ConnectionPool.GetConnection(Boo...

How can I replicate Roles with SQL Server 2005 Replication

How can I have the security Roles replicated when I setup a Transactional Publication replication? Currently I have all the data, stored proc, views, indexes, etc... replicated, but I had to create the Roles and assign them to my users to have a working replication server. Is there a way to include security information when replicating...

SQL Server 2005 Fail: Return Dates As Strings

Hello all, I am using the SQL Server PHP Driver, I think this question can be answered without knowing what this is. I have come across this many times, what does it mean by NAMES? Column names?: SET NAMES utf8 Is there a query similar to the above that will get my dates to be returned as a string? For some reason on my SQL Sever 20...

Correct escaping of delimited identifers in SQL Server without using QUOTENAME

Is there anything else that the code must do to sanitize identifiers (table, view, column) other than to wrap them in double quotation marks and "double up" double quotation marks present in the identifier name? References would be appreciated. I have inherited a code base that has a custom object-relational mapping (ORM) system. SQL ...

SQL Server 2005 - How to find out what transaction log files have been restored.

How can you find out what transaction log backup files have been restored using SQL in SQL Server 2005? ...

Help ! How do I get the total number rows from my SQL Server paging procedure ?

Ok I have a table in my SQL Server database that stores comments. My desire is to be able to page though the records using [Back],[Next], page numbers & [Last] buttons in my data list. I figured the most efficient way was to use a stored procedure that only returns a certain number of rows within a particular range. Here is what I came u...

SSIS 2005 - How to get the timestamp properties for a file

How do you get a timestamp from a file with SQL Server Intergration Services 2005? ...

How to reference a sql server with a backslash (\) in its name?

Givens: One SQL Server is named: DevServerA Another is named: DevServerB\2K5 Problem: From DevServerA, how can I write a query that references DevServerB\2K5? I tried a sample, dummy query (running it from DevServerA): SELECT TOP 1 * FROM DevServerB\2K5.master.sys.tables And I get the error: Msg 102, Level 15, State 1, Line...

SQL 2005 - How to determine what time a restored file was orginally backed up.

How do you figure out what time a restored file was originally backed up under SQL Server 2005? ...

SQL query optimization

I have a problem with my SQL query that take time to get all records from database. Any body help me. Below is a sample of database: order(order_id, order_nm) customer(customer_id, customer_nm) orderDetail(orderDetail_id, order_id, orderDate, customer_id, Comment) I want to get latest customer and order detail information. Here is m...

typed-Dataset VS Own access Database classes

Hi i would like to know if it's better to use typed-dataset rather than Own access with Datareader and Store procedure? ...

Timeout expired in sql server problem

set con2=server.CreateObject("ADODB.Connection") con2.ConnectionTimeout =1200 con2.open "Driver={SQL Server};server=111.111.111.11;user id=xx;pwd=xxx;Database=xxx" con2.execute("DELETE FROM tablename WHERE fieldid NOT IN(SELECT fieldid FROM tablename2)") con2.close set con2=nothing when i running this query using asp the following erro...

DataTable identity column not set after DataAdapter.Update/Refresh on table with "instead of"-trigger (SqlServer 2005)

Within our unit tests we use plain ADO.NET (DataTable, DataAdapter) for preparing the database resp. checking the results, while the tested components themselves run under NHibernate 2.1. .NET version is 3.5, SqlServer version is 2005. The database tables have identity columns as primary keys. Some tables apply instead-of-insert/update ...

how to modify xml

I need to first retrieve an xml and then add an attribute to every node of a xml. Can any one plz guide how can I do this in SQL. ...

SQL Server 2005. Full Text Search. Need Thesaurus working with NEAR/AND/OR keywords

Hi, does anyone know if it's possible to do a thesaurus search together with NEAR or AND/OR keywords. Here is an example of the type of query I want to run: SELECT Title, RANK FROM Item INNER JOIN CONTAINSTABLE(Item, Title, 'FORMSOF(Thesaurus, "red" NEAR "wine")') AS KEY_TBL ON Item.ItemID = KEY_T...

SQL Database Mirroring and your web application

You have two servers when you perform a SQL Server database mirroring You have 1 primary database and 1 mirror database Do you need to make any changes to web application to tell it that your using database mirroring? If not how does your web application know which database to use when the primary database fails? ...