sql-server

Is there a way to loop through a table variable in TSQL without using a cursor?

Let's say I have the following simple table variable: declare @databases table ( DatabaseID int, Name varchar(15), Server varchar(15) ) -- insert a bunch rows into @databases Is declaring and using a cursor my only option if I wanted to iterate through the rows? Is there another way? ...

What could be good ways to deploy ASP.Net Web Applications?

We currently deploy web applications by creating a database and running SQL scripts through query analyzer. Then we copy the output from "publish website" and set up that website in IIS. We have seen websetup in visual studio, but that part seems to be thinly documented. For example, we are not clear how to ask the user for IP and pas...

Best way of constructing dynamic sql queries in C#/.NET3.5?

Hello, A project I'm working on at the moment involves refactoring a C# Com Object which serves as a database access layer to some Sql 2005 databases. The author of the existent code has built all the sql queries manually using a string and many if-statements to construct the fairly complex sql statement (~10 joins, >10 sub selects, ~1...

Microsoft SQL Server 2005 service fails to start

I’ve been trying to install Ms SQL Server 2005 for over two weeks now, and I’ve finally gotten to the point where the prerequisites all seem to be in place. Unfortunately, every time I try to install SQL Server itself, I get the following message: “The SQL Server service failed to start. For more information, see the SQL Server Books On...

SQL: Select columns with NULL values only

How do I select all the columns in a table that only contain NULL values for all the rows? I'm using MS SQL Server 2005. I'm trying to find out which columns are not used in the table so I can delete them. ...

How do you perform an IF...THEN in a SQL SELECT

I want to be able to perform a IF...THEN in an SQL SELECT Statement. For Example; SELECT IF(Obsolete = 'N' or InStock = 'Y';1;0) as Salable, * FROM Product ...

What user account would you recommend running the SQL Server Express 2008 services in a development environment?

The SQL Server Express 2008 setup allow you to assign different user account for each service. For a development environment, would you use a domain user, local user, NT Authority\NETWORK SERCVICE, NT Authority\Local System or some other account and why? ...

Can I write a plug in for Microsoft SQL Enterprise Manager which changes the query window background

... if the query window points to a production database? ...

Fastest way to delete all the data in a large table

I had to delete all the rows from a log table that contained about 5 million rows. My initial try was to issue the following command in query analyzer: delete from client_log which took a very long time. ...

How to add a constant column when replicating a database?

I am using SQL Server 2000 and I have two databases that both replicate (transactional push subscription) to a single database. I need to know which database the records came from. So I want to add a fixed column specified in the publication to my table so I can tell which database the row originated from. How do I go about doing this...

How to force nolock hint for sql server logins

Does anyone know of a way to force a nolock hint on all transactions issued by a certain user? I'd like to provide a login for a support team to query the production system, but I want to protect it by forcing a nolock on everything they do. I'm using SQL Server 2005. ...

How can you cascade filter the attributes of more dimensions in a SSAS cube, viewed in Excel 2007

How can you cascade filter the attributes of more dimensions in a SSAS cube, viewed in Excel 2007. For example, if we have a cube Sales with the dimension Time and dimension Client, once the dimension Time is filtered to show only the sales from a particular date, if "Client.ClientName" is chosen as a filter in the filter area, how can ...

How do you create SQL Server 2005 stored procedure templates in SQL Server 2005 Management Studio?

How do you create SQL Server 2005 stored procedure templates in SQL Server 2005 Management Studio? ...

SQL Server 2005 How Create a Unique Constraint?

How do I create a unique constraint on an existing table in SQL Server 2005? I am looking for both the TSQL and how to do it in the Database Diagram. ...

Importing Access data into SQL Server using ColdFusion

This should be simple. I'm trying to import data from Access into SQL Server. I don't have direct access to the SQL Server database - it's on GoDaddy and they only allow web access. So I can't use the Management Studio tools, or other third-party Access upsizing programs that require remote access to the database. I wrote a query on the...

Using Rails 2.x with MS SQL Server 2005

Does anybody here have positive experience of working with MS SQL Server 2005 from Rails 2.x? Our developers use Mac OS X, and our production runs on Linux. For legacy reasons we should use MS SQL Server 2005. We're using ruby-odbc and are running into various problems, too depressing to list here. I get an impression that we're doin...

How do I determine using TSQL what roles are granted execute permissions on a specific stored procedure?

Is there a system stored procedure or a system view I can use? ...

SQL 2000 equivalent of SQLAgentReaderRole

I have quite a few developers asking me if certain SQL jobs ran, and I would like to give them access to check it on their own without giving them 'sysadmin' rights. I know that in SQL 2005, you can grant them the SQLAgentReaderRole, but I am looking for a solution in SQL 2000. ...

A checklist for fixing .NET applications to SQL Server timeout problems and improve execution time

A checklist for improving execution time between .NET code and SQL Server. Anything from the basic to weird solutions is appreciated. Code: Change default timeout in command and connection by avgbody. Use stored procedure calls instead of inline sql statement by avgbody. Look for blocking/locking using Activity monitor by Jay Shepher...

Does MSSQL 2005 Scale to a Large Number of Databases?

If I add 3-400 databases to a single MSSQL server instance will I encounter scaling issues introduced by the large number of databases. ...