sql-server-2005

Sorting the data returned by a database

hi all, In our project we have a requirement that when a set of records are returned by the database the records should be sorted with respect to the TITLE field in the record. The records will have to be sorted alphabetically but if the title of a record has a number in it then it should come after the records whose title only consists...

SQL Server 2005 Issue Column name or number of supplied values does not match table definition.

Hello, I wish to DELETE the data from a table before performing an INSERT INTO, however I keep recieving an error stating: Insert Error: Column name or number of supplied values does not match table definition. I've also tried defining the columns the data should be entered into as part of the INSERT INTO statement, but then get issu...

Where does sql server stores the stored procedure code?

I once needed the lines of the stored procedures, to be able to trace whether i have a reference to some function, procedure or table, or sometimes to try to find something inside of the sp's code. Where does the sql server stores the procedures's code? ...

Database migration

We are migrating a client's own database schema to our own (both SQL-Server). Most of the mappings from their schema to ours have been indentified and rules been agreed on if the columns don't exactly align (default values etc.) Previously, depending on who was assigned the task, this has been done either with a mixture of sql scripts o...

Using SQL 2005 Pivot

I need to turn the following results... RowID ColumnName Value ======= ============ ========== 200 Status OK 200 Name Project 1 200 Created 01/01/2010 00:00 201 Status FAILED 201 Name Project 2 201 Created 02/01/2010 18:00 202 Status OK 202 Name Proj...

Inserting Large volume of data in SQL Server 2005

We have a application (written in c#) to store live stock market price in the database (SQL Server 2005). It insert about 1 Million record in a single day. Now we are adding some more segment of market into it and the no of records would be double (2 Millions/day). Currently the average record insertion per second is about 50, maximum ...

Error while installing Microsoft SQL Server 2005 on Windows 7

I was trying to install Microsoft SQL Server 2005 on my Windows 7 pc. When I tried to install it, it tells me that I have a newer version installed on my pc. So, I checked that Microsoft Sharepoint 2010 installed some sql server 2008 tools for me. I decided to uninstall SharePoint 2010(which I wasn't using) and then tried to install MS ...

Import excel file into sql express 2008

Hi, I've got some excel files, that were exported from tables in Access, and I want to import them into sql express 2005. I need a script that will convert nvarchar(255) columns to varchar(255) and preserve links, when importing the data into sql express. Thanks ...

How to organize infinite while loop in SQL Server ?

I want to use infinite WHILE loop in SQL Server 2005 and use BREAK keyword to exit from it on certain condition. while true does not work, so I have to use while 1=1. Is there a better way to organize infinite loop ? I know that I can use goto, but while 1=1 begin .. end looks better structurally. ...

Why doesn't Data Driven Subscription in SSRS 2005 like my Stored Procedure?

I'm trying to define a Data Driven Subscription for a report in SSRS 2005. In Step 3 of the set up you're asked for: " a command or query that returns a list of recipients and optionally returns fields used to vary delivery settings and report parameter values for each recipient" This I have written and it returns the data without a h...

how Do I list all table names in SQL Server using T-SQL?

SELECT name FROM sys.databases -- this can list all database name in the server user database SELECT * FROM INFORMATION_SCHEMA.TABLES -- these two line can list the table for one particular database But how can I output the results like below? Database Table --------- ------------- db1 ...

Contains performs MUCH slower with variable vs constant string SQL Server

For some unknown reason I'm running into a problem when passing a variable to a full text search stored procedure performs many times slower than executing the same statement with a constant value. Any idea why and how can that be avoided? This executes very fast: SELECT * FROM table WHERE CONTAINS (comments, '123') This executes ver...

Testing Deployment of Custom Security Extensions in SSRS 2005

Hello, Trying to debug a deployed SSRS security customization (to use forms auth) as described here: http://msdn.microsoft.com/en-us/library/ms160724(SQL.90).aspx. There is a section about debugging your application... I followed the steps I think, but I cannot debug this. Has anyone got any advice as to how to debug a custom Forms ...

Querying to construct XML in TSQL without a source table, only variables?

Using a SELECT statement in MS SQL 2005 TSQL, and no source table, just variables as listed below... @FirstName varchar(20) @LastName varchar(20) @ZipCode varchar(5) ...what syntax will build XML resembling the following? <XMLDATA><REC FirstName="JOHN" LastName="SMITH" ZipCode="98052" /></XMLDATA> ...

Where should the partitioning column go in the primary key on SQL Server?

Using SQL Server 2005 and 2008. I've got a potentially very large table (potentially hundreds of millions of rows) consisting of the following columns: CREATE TABLE ( date SMALLDATETIME, id BIGINT, value FLOAT ) which is being partitioned on column date in daily partitions. The question then is should the primary key be ...

How to use split in SQL Server 2005?

Table column has values with comma separated for ex: (1,2,3) How to split this like 1 2 3 or 1 2 3 in SQL Server 2005. ...

SQL script to show addition to tables

Hey all I have a 2 MS SQL 2005 databases,a TEST and DEV database. Now our developer added some extra columns,tables etc in the DEV database.This created differences in the TEST database.is there a script i can write tha can tell me what the changes where in the DEV database between certain dates...i found a couple of tools but they are...

SQL Server Express 2005 Merge Replication using RMO causes Null Reference exception

I'm trying to use RMO to programmatically perform merge synchronization. I've basically copied the SQL Server example code, as follows: // Create a connection to the Subscriber. ServerConnection conn = new ServerConnection(subscriberName); MergePullSubscription subscription; try { // Connect to the Subscriber. conn.Connect(); ...

How do I perform an accent insensitive compare (e with è, é, ê and ë) in SQL Server?

I'm looking to compare two varchars in SQL, one would be something like Cafe and the other Café is there a way in SQL that will allow the two values to be compared. For instance: SELECT * FROM Venue WHERE Name Like '%cafe%' So if there is a venue with the name Big Bobs Café Extraordinaire it would be included in the result set? ...

How to join dynamic sql statement in variable with normal statement

I have a quite complicated query which will by built up dynamically and is saved in a variable. As second part i have another normal query and i'd like to make an inner join between these both. To make it a little more easier here is a little example to illustrate my problem. For this little example i used the AdventureWorks database. ...