sql-server

Save image column to file in SQL Server 2000

I have a table with an image column in SQL Server 2000. I need to save the image data to a file on the file system. In SQL Server 2005 I can use the ADODB.Stream object for file I/O but this doesn't seem to exist in SQL Server 2000. The closest thing I can find is Scripting.FileSystemObject but it only seems to have support for text f...

Is there a way to supply query parameters to a SQL Server Reporting Services Report at deployment time rather than at design time

Hello, SUMMARY: I have created a SSRS Report. I want to be able to supply parameters for the report at DEPLOYMENT time rather than just design time or runtime. DETAILS: I want to create ONE report and deploy it multiple times with the only difference being that I want to change one of the query parameters. I do not want to prompt...

DateInterval.minute is not a recognized dateadd option

I'm trying to test a developer's application against a SQL Server 2005 database (80) instead of the normal SQL Server 2000 database that it would hit. Is anyone aware of issues that could cause this error that are related to SQL? 'DateInterval.minute' is not a recognized dateadd option. Description: An unhandled exception occurred dur...

Is it possible to defer referential integrity checks until the end of a transaction in SQL Server?

I recently read in Fowler's PofEA that some database engines allow you to defer RI checks until the end of the transaction. Is this possible in SQL Server? The problem comes with some scenarios where I am trying to save changes that include insertions and deletions, it can be tricky to determine the correct order in which to perform th...

Suspended status in SQL Activity Monitor

What would cause a query being done in Management Studio to get suspended? I perform a simple select top 60000 from a table (which has 11 million rows) and the results come back within a sec or two. I change the query to top 70000 and the results take up to 40 min. From doing a bit of searching on another but related issue I came ...

SQL Queries - Creating a Grid from Three Columns

My SQL table has three columns: TaskID VarID Hours 001 001 10 001 002 40 001 003 100 002 001 50 002 002 80 002 003 90 I want to produce output like the following TaskID VarID -> 001 002 003 001 10 40 100 002 50 ...

What can cause this Login Failed Error?

When I try to connect to SQL Server 2005 Enterprise edition on my local machine I get the below error: "Cannot open user dafault database.Login failed. Login Failed for user "Domain\My name" What can cause this error? ...

Rails + SQL Server + Mac OS X

Alright. While there are a few blog posts here and there purporting to make this process easy, this is absolutely driving me crazy. Here's what I've done: I've installed FreeTDS (with and without +mssql) but encounter problems when I use it to connect to my remote DB instance. When I attempt tsql -H [remote-db-ip] -p 1433 -U [valid-...

lu.[TableName] instead of dbo.[TableName]?

Some of the tables in my SQL Server 2005 database is named as lu.[TableName] instead of dbo.[TableName]. What does lu stand for? Note: I tried google already ...

SQL Two Tables, One Result with extras

I have two tables. The first Holds a list of classes with basically an ClassID and a ClassName. The second Holds a list of classes that a pupil does attend using ClassID and PupilID (PupilID refers to a third table). Is it possible to return for a given pupil a list of ALL Classes irrespective of attendance yet indicate the classes they...

sql server enumerate current session variables

Is it possible to enumerate the currently-defined session variables? I've been looking for the equivalent of select * from sys.tables for session variables, but I can't find a sys view that contains that information. I'm wondering if it's possible to spin through them and print them to the response window. I've got about 35+. ...

Swap values between two rows of data

The following T-SQL code segment works but i'm wondering if there's a cleverer and/or less verbose way to accomplish the swapping of field values between two different rows. (The code has hard-coded pkey values for simplicity.) BEGIN TRAN; declare @swapFormSeqA int; declare @swapFormSeqB int; SELECT @swapFormSeqA = DisplaySeq FROM Cus...

What does database query and insert speed depend on?

At my work we have a small database (as in two hundred tables and maybe a total of a million of rows or so). I've always expected it to be quite fast in the order of several ten of thousands insertion per second and with querys taking milliseconds once the connection is established. Quite the contrary we are having some performance pro...

Why isn't Snapshot isolation supported with Distributed Transactions in SQL Server

Question is in the title. I'd just love to understand why this isn't supported? Just to clarify this is MS Sql Server 2005 / 2008. ...

c# conversion of a datetime2 data type to a datetime data type

I've got a datatable with 5 columns, that is being filled with data. From here I'm going to the database and save the whole datatable setting it into an transaction. While saving, I'm getting an error that says "conversion of a datetime2 data type to a datetime data type resulted in an out-of-range value." As I understand it good, it s...

changing datetimemode using SQLDataReader

Hi, Does anyone know whether it is possible to change the datetimemode when using a datareader. All the examples, as below, I can find use a datatable. SqlCommand command = new SqlCommand("SELECT EmployeeID, FullName, DateCreated, DateAppointment FROM [Employees] ...", connection); SqlDataAdapter adapter = new SqlDataAdapter(...

Avoiding Cursor in SQL

What is the best alternative to using a cursor in SQL if I am suffering from performance issues ? I got the following code wherein it uses Cursor to loop through and insert records. --Extract Column Data From Pit To Port AuditLog to QmastorAudit AuditLog DECLARE @AuditBatchID_logRow INT, @AuditOperationID_logRow INT, @RowIdentifie...

Updating table based on Select Query in StoredProc / ColdFusion

I am using ColdFusion for for a project and I have a written a query which I think can be faster using a Stored Proc, but I not a T-SQL person, so I am not sure how to do it to compare. I am running an initial query which selects a number of fields from a table based on a dynamically built cfquery. I think I know how to convert this qu...

SQL Server -SP execution path is stored on Stack ?

When I execute a stored procedure first time, it (for example) takes 3 minutes to execute. Once it is precompiled, it takes 1 minute to execute. After 3 months (without using the SP further), when I try to execute it again it takes 3 minutes. My question Is the execution path stored on stack? Or it is due to some other factor?. Corr...

Is there a way to migrate SQL Server to Vistadb (Umbraco)

I am on a shared host and whilst in development (umbraco) I think it would be easier to use VistaDB then package up to install to SQL Server. However, I have already started using SQL Server. Is there a way to migrate my SQL Server (2008) database to VistaDB. I assume the schema is identical but I need a way/tool to move the data to Vist...