sql-server-2005

VB or C# for SQL Server - Just learning SQL Server (going from Access)

I am just getting into SQL Server, and I have some experience with MS Access an Visual Basic (well VB within Access anyway). So I am trying to acquire materials (books, etc) to learn how to program sql server, and I am wondering if I should go the C# route instead of visual basic for sql server?? not super familiar with c# (though i am ...

SQL recursive query

Possible Duplicate: Recursive function in sql server 2005? How do you perform an iterative query on a table? I have a simple table which consists of a: KeyField, childID, parentID Starting with a childID, I want to pull the parentID and then query again to see if that parent (which is now the child) has its own parent, worki...

Why does Bulk Insert block Update in MS SSIS?

I have an SSIS package set up like this: If I run only the New Rows flow the Bulk Insert finishes without a problem, but as soon as i connect the Live Rows flow the package stalls indefinitely. When I check the activity monitor the Update Newer Table Rows task stalls, blocked by the Insert New Rows task. Why does the Bulk Insert not ...

How to connect to SQL Server 2005 database through Ruby

How to connect to SQL Server 2005 database through Ruby in Windows ...

how to run a parallel query on sql server 2008?

i want to run a query on multiple processors. what is the syntax to run a parallel query? please provide a sample query ...

how can i analyze the results of the sql query : dbcc showcontig ?

how can i analyze the results of the sql query : dbcc showcontig to improve the performance of sql ...

How to show value printed by sql query in message box

I want to print a value that is returned by sql server. If NOT Exists(SELECT * FROM ItemList WHERE ItemName='txtItemNama') BEGIN INSERT INTO ItemList (ItemName) VALUES('txtItemNamea') END ELSE BEGIN Print 'Duplicate' END This query will either return me either no of rows effected or Duplicate I want to ...

de-duplicating rows in a sql server 2005 table

I have a table with ~17 million rows in it. I need to de-duplicate the rows in the table. Under normal circumstances this wouldn't be a challenge, however, this isn't a normal circumstance. Normally 'duplicate rows' is defined as two or more rows containing the exact same values for all columns. In this case 'duplicate rows' is defined a...

What is wrong with this sql syntax?

Hai guys, I got the error Cannot call methods on nvarchar. when i executed the below sql query select User.[User_Id],User.[User_Name],User.Email_Id,User.Password,Role.Role_Id,Role.Role_Name,Role.Role_Description From [User] inner join [Role] on User.Role_Id=Role.Role_Id what is wrong in the above query? ...

How to index a table with a Type 2 slowly changing dimension for optimal performance

Suppose you have a table with a Type 2 slowly-changing dimension. Let's express this table as follows, with the following columns: * [Key] * [Value1] * ... * [ValueN] * [StartDate] * [ExpiryDate] In this example, let's suppose that [StartDate] is effectively the date in which the values for a given [Key] become known to the system. ...

Permissions Design

I have an application that has content that needs to be setup for permissions (i.e. member/non-member) I have roles/authentication setup just fine, that is not my issue. My question is basically asking the best way to store permissions for each object. Essentially there is "Guest" and "Member" roles, and simple "Allow" "Deny" permission...

SQL recursive CTE query error 'invalid column name - level'

Trying to write a recursive CTE query, keep getting the following error: level, invalid column name This is the query, where am I going wrong? WITH OwnerHierarchy AS ( SELECT PairID, ChildID, ParentID, 0 AS level FROM BusinessHierarchy UNION ALL SELECT e.PairID, e.ChildID, ...

Suppress T-SQL warnings generated by IGNORE_DUP_KEY

Is there a way to suppress warnings generated by inserting duplicate keys on indexes with IGNORE_DUP_KEY = ON? The warning it gives is "Duplicate key was ignored." I am investigating using this option with a table variable for performance reasons, but it generates a lot of warning messages. This can be a problem since I log the output...

How to hide all databases I am not authorised to use in Sql Server 2005 Management Studio?

I have to access some customers databases being hosted in a shared environment. There are numerous databases being hosted on any given customers instance. So everytime I access a database I have to scroll and search. I would like to be able to configure Management Studio to just go directly to the database I want to work with for a giv...

SQL Server 2005 64 bit

hi, i have windows 7 64 bit. I have installed SQL Server 2005 32 bit in it. it installed properly but the native clients says its not proper or compatible to run in x64 mode.My question: Where can i get native client that can be run on 64 bit OR Is SQL Server 2005 there for 64 bit? Thanks ...

What is the most efficient way to insert thousands of records after a click event?

Hai guys, I ve developed a web application using asp.net and sql server 2005 for an attendance management system.. As you would know attendance activities will be carried out daily.. Inserting record one by one is a bad idea i know,my questions are Is Sqlbulkcopy the only option for me when using sql server as i want to insert 100 rec...

How do i unblock a process (Insert Stmt) blocked by a parent process (Insert Stmt) with in a TransactionScope.

I have a child TransactionScope within a parent TransactionSope. The child TransactionScope is created, executed, and committed multiple times under the singular parent TransactionScope. The parent TransactionScope takes care of Insert a single record into the database while waiting for the the second set of insert statements to complet...

How to validate the below format in SQL SERVER 2005(SET BASED)

How to restrict the length? Like 12345.789.22.7890 is invalid because the IP ranges from 0-255 Kindly help me ...

Extracting Characters in SQL SERVER 2005?

What is the best way of extracting the values from vvv.www.xxx.yyy.zzz Note that vvv or www or xxx or yyy or zzz can vary i.e. it can be of any length. For this reason I cannot use substring with charindex. I don't want to do this with LOOP or CURSOR . By using CTE and a number table also it can be done but that will be a bit lengthy ...

SQL Server 2005 T-SQL Problem : Can you trust the Query Optimizer ? I know I can't !

Hello, This question is linked to my previous one ( posted as an anonymous user - now I have an account ) and, before I begin, I would like to give the credit to Rob Farley for providing the right indexing schema. But the problem is not the indexing schema. It's the Query Optimizer ! The query : SELECT s.ID_i , s.ShortName_v ...