sql-server

Raiseerror and Concat for the Message

I'd like to do something like this raiserror(concat('Error in case @isFishy =', @isFishy, ' @isSmarmy=', @isSmarmy, ' @isTasty = ', @isTasty), 10, 1) --or raiserror('Error in case @isFishy =' + @isFishy + ' @isSmarmy=' + @isSmarmy + ' @isTasty = ' + @isTasty, 10, 1) But it just isn't working. How do I accomplish this? I'm in SQL S...

Whats the best way to profile a sqlserver 2005 database for performance?

What techinques do you use? How do you find out which jobs take the longest to run? Is there a way to find out the offending applications? ...

Semi-Tricky SQL Query

I am trying to write a query for SQL Server 2005 but I can't figure out how to do it. I have a table with the following fields: MessageID int CategoryID int Priority tinyint MessageText NVARCHAR(MAX) I need a query that will return * for each row that has the highest priority within a Category. For example, if I had the following dat...

Automated unit testing SSIS packages

How can I unit test SSIS packages? I want to be able to create and maintain unit tests for various components such as the workflow tasks, data flow tasks, event handlers, etc. Are there any existing techniques, frameworks, and/or tools that can be used? ...

SQL Server 2005 - Granting permission to create stored procedures (but no other objects)

I want to grant a user permission to create, alter, and execute stored procedures, but without the ability to create other database objects. I excluded them from the role db_ddladmin, but explicitly granted the permissions "Create procedure" and "Execute". These permssions appear in the effective permissions list. However, when I try ...

How to run a very large query (SQL Server and ColdFusion)

I've got a reasonably simple query (this time) that I need ALL the results back from (I'm storing them in an excel spreadsheet). The query itself times out the server, so how do I go about running it without that happening? ...

What is the preferred format to store date/times in a SQL Server database when PHP is your primary language?

I am planning a PHP application that needs to store date/times in an MSSQL database. (For the curious, it is a calendar application.) What is the preferred format to store this information? MSSQL has its own datetime data type, which works well in the database itself and is very readable. However, there aren't any MSSQL functions to tra...

SQL Server Row Length

I'm attempting to determine the row length in bytes of a table by executing the following stored procedure: CREATE TABLE #tmp ( [ID] int, Column_name varchar(640), Type varchar(640), Computed varchar(640), Length int, Prec int, Scale int, Nullable varchar(640), TrimTrailingBlanks varchar(640), FixedLenNullI...

Question about skipping IDs in an identity column in MSSQL...

Say I have an MSSQL table with two columns: an int ID column that's the identity column and some other datetime or whatever column. Say the table has 10 records with IDs 1-10. Now I delete the record with ID = 5. Are there any scenarios where another record will "fill-in" that missing ID? I.e. when would a record be inserted and giv...

Apart from initial cost, are there any other benefits of using MySQL over MSQL server with .net?

I've used both and I've found MySql to have several frustrating bugs, limited support for: IDE integration, profiling, integration services, reporting, and even lack of a decent manager. Total cost of ownership of MSSQL Server is touted to be less than MySQL too (.net environment), but maintaining an open mind could someone point out any...

SQL Server 2005: Deny Access to sp_prepexec

I have a SQL Server 2005 database that is suffering from lock starvation because of some poorly behaving applications running cursors through sp_prepexec. I imagine that one of the applications running a cursor has "forgotten" to close it. I would like to deny access to sp_prepexec for specific users to prevent the lock starvation from...

Using SQL Server DTS Package to Conditionally Insert / Update Rows in Destination Table

I want to create a DTS Package to pull data from an Oracle table into a SQL2K table. How can I insert rows that are not already in the SQL2K table and update rows that already exist in the SQL2K table? I guess I could truncate and repopulate the entire table or create a temporary table and then do updates/inserts from the temp table...

SQL stored procedure temporary table memory problem

We have the following simple Stored Procedure that runs as an overnight SQL server agent job. Usually it runs in 20 minutes, but recently the MatchEvent and MatchResult tables have grown to over 9 million rows each. This has resulted in the store procedure taking over 2 hours to run, with all 8GB of memory on our SQL box being used up. T...

Creating stored procedure on the fly. What are the risks/problems?

I am thinking about creating stored procedures on the fly. ie running CREATE PROCEDURE... when the (web) application is running. What are the risks or problems that it can cause? I know that the database account needs to have the extra privileges. It does NOT happen everyday. Only from time to time. I am using sql server and inter...

What hardware (config) and software (os version/app version) is recommended for developing for ASP.NET/Coldfusion and MS SQL Server?

Hi, We are a small company and would like to know the best possible (and affordable) hardware and software configuration we ought to be using for our development environment. At this moment we are a team of four people who work remotely from different locations and each one of us uses a laptop and ADSL connection to work on our projects...

why shrink a sqlserver 2005 database?

What are the advantages and disadvantages of shrinking a database? Are there any performance implications? ...

SQL Server reporting services

how to show all values of a particular field in a text box ??? ie. for eg. when u run the SP, u'll be getting 3 rows. and i want to show the (eg.empname) in a textbox each value separated by a comma. (ram, john, sita). ...

Microsoft.SqlServer.Management.Smo and its brothers works on SQL2000?

As title, I need that to run an import script generated by SQL Server DB Publishing Tool. Would that work on Sql2000 server too? Also I have seen ppl reporting missing library issues related to GAC, which libraries I precisely need to include if I am not controlling the deployment server? To know how this thing works you can check here ...

Migrate table from MS SQL Server to MySQL

Hello, I have to migrate a table from MSSQL Server to MySql. The problem is that the table is quite big (65 millions records) and the whole process takes too much time. Does anyone have any idea how to speed things up ? Any useful tools that could improve this? ...

TSQL Email Validation (without regex)

Ok, there are a million regexes out there for validating an email address, but how about some basic email validation that can be integrated into a TSQL query for Sql Server 2005? I don't want to use a CLR procedure or function. Just straight TSQL. Has anybody tackled this already? ...