Tag: sql-server-2005

SQL Server Multiple Joins Are Taxing The CPU

I have a stored procedure on SQL Server 2005. It is pulling from a Table function, and has two joins. When the query is run using a load test it kills the CPU 100% across all 16 cores! I have determined that removing one of the joins makes the query run fine, but both taxes […]

SQL Server 2005 Fail: Return Dates As Strings

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 […]

How to get the start time of an SQL process?

A job running on our SQL server failed. We are running MS SQL server 2005. While investigating, the following question came up: When was this process initiated on the server? Is there any query I can run that will give me this information?

T-SQL Reverse Pivot on every character of a string

We have a table like below in an sql server 2005 db: event_id staff_id weeks 1 1 NNNYYYYNNYYY 1 2 YYYNNNYYYNNN 2 1 YYYYYYYYNYYY This is from a piece of timetabling software and is basically saying which staff members are assigned to an event (register) and the set of weeks they are teaching that register. […]

SQL Server 2005 and APP_DATA

I was once told that instead of having to have my host register a SQL Server database file + user/password it is possible instead to put my MDB file into my website’s APP_DATA and connect to it directly. How do I do this? I tried using the SqlConnection’s connection wizard and set DataSource : Microsoft […]

TSQL Help (SQL Server 2005)

I have been playing around with a quite complex SQL Statement for a few days, and have gotten most of it working correctly. I am having trouble with one last part, and was wondering if anyone could shed some light on the issue, as I have no idea why it isnt working: INSERT INTO ExistingClientsAccounts_IMPORT […]

SQL Server 2005 Replication Debugging Suggestions

I have a replication setup it was up and running yesterday, now I can’t connect to the distributor and I don’t know why. The publisher is on a Domain and talks to the subscriber (not on the domain) via VPN. I can ping the publisher from the subscriber and vice-versa. I can log in to […]

Need help creating complex T-SQL SELECT statement

I am trying to make SELECT statement for following situation and need help to make this SELECT statement. It’s SQL Server 2005. When the select statement is run, it should return rows which have SentDate as NULL assuming that there are no duplicate PersonID in table. It will return result set with Status as ‘Initial […]

SQL Server: pause a trigger

I am working with SQL Server 2005 and I have trigger on a table that will copy an deletions into another table. I cannot remove this trigger completely. My problem is that we have now developed an archiving strategy for this table. I need a way of “pausing” a trigger when the stored proc that […]

How to copy from a database to a text file using VBScript?

I have an example in C# code, but it is using streamWriter. It must be involving with FileSystemObject rite. If yes, what are methods should I use? I want to code using VBScript WSH, and my database is MS SQL Server 2005. Any solution, references, or guide are helpful. using (StreamWriter tw = File.AppendText(“c:\\INMS.txt”)) { […]

MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.