sql-server

how do I add a SQL Server 2008 service instance?

I upgraded from SQl server 05 to 08 and had a few issues. After uninstalling 05 and a few restarts later 08 installed okay, but now I don't have any SQL Server services running. I can't connect to (local)\SQLExpress or .\SQLEXPRESS via SQL Server management studio and the SQL Server services dialog shows no services. There's no add butt...

Copying BLOB values between databases with pure SQL in SQL Server

I need to pull some BLOB data from a SQL Server 2005 database and generate a SQL script to insert this same data in another database, in another server. I am only allowed to do this using SQL scripts, I can't use any other utility or write a program in Java or .NET to do it. The other big restriction I have is that I don't have access ...

How do I delete all the records in a table that have corresponding records in another table

I have two tables A and B. I would like to delete all the records from table A that are returned in the following query: SELECT A.* FROM A , B WHERE A.id = B.a_id AND b.date < '2008-10-10' I have tried: DELETE A WHERE id in ( SELECT a_id FROM B WHERE date < '2008-10-10') but that only works if the inner select ac...

How to put BIDS solutions under source control?

I am starting to work with Microsoft BI suite: Analysis services 2005, Business Intelligence Development Studio 2005, stuff like that. Of course my first wish was to set up the same source control/automated testing environment I have for my .NET projects. But xml files used by Analysiss services (dwproj, cube, dim, ds, dsv) and Integ...

Alternative to BACKUP LOG WITH TRUNCATE_ONLY

This piece of T-SQL is deprecated in 2005: BACKUP LOG [DB_NAME] WITH TRUNCATE_ONLY I don't need to keep a backup the log for my db - but I do not want the piece of code to stop working if we port to SQL2008 or successive versions in future. Cheers ...

How does SQL Server Licensing work on Amazon's EC2?

It appears from their marketing literature that their new Windows with SQL option on EC2 has the SQL licensing costs bundled into their instance charges, but I'd hate to make assumptions. Has anyone here that has actually used a SQL instance on EC2 confirm/deny that the SQL Licensing costs are bundled into the instance chanrges from Am...

SQL Server Print Blank Line Without Space

In SQL Server 2005, I want to print out a blank line with the PRINT statement, however, when I run PRINT '' it actually prints a line with a single space. Does anyone know if it's possible to just print a blank line without the space? If I print a new line character, it doesn't print a space, but I end up with two new lines. ...

SQL Server 2005 Named Instance port problem

Hi, I have 4 different named instances of SQL Server 2005 on a single server (for testing purposes). There is no default instance on the server. Because I will eventually need to allow communication to these instances across the firewall, I have set the ports of each instance statically listening on all IPs for the server. Edit: TCP/I...

SQL Server online backup with MozyPro

Anyone using MozyPro to backup SQL Server databases? I'm concerned about the way it does the backup. It just copies data files the way they are. Not using the backup database command. Is it safe? ...

Java O/R layer for SQL server?

I've got a java server (not web based, more like a big, many-threaded standalone application) that needs to talk to a MS SQL Server database. I just worked on a different project that ported a home-grown O/R layer from oracle to SQL Server, and it ran into significant problems because of too many oracle assumptions (locking, mostly). S...

Speed up sql JOIN

First of all, some background. We have an order processing system, where staff enter billing data about orders in an app that stores it in a sql server 2000 database. This database isn't the real billing system: it's just a holding location so that the records can be run into a mainframe system via a nightly batch process. This batch...

Stored Procedure failing on a specific user

I have a Stored Procedure that is constantly failing with the error message "Timeout expired," on a specific user. All other users are able to invoke the sp just fine, and even I am able to invoke the sp normally using the Query Analyzer--it finishes in just 10 seconds. However with the user in question, the logs show that the ASP alwa...

SQL Server Profiler - How to filter trace to only display events from one database?

How do I limit a SQL Server Profiler trace to a specific database? I can't see how to filter the trace to not see events for all databases on the instance I connect to. ...

MS SQL: Convert Datetime column to nvarchar

I need to select a datetime column in a table. However, I want the select statement to return the datetime as a nvarchar with the format DD/MM/YYYY. ...

Connecting to AdventureWorks database (SQL Server 2005 Express) through Visual Studio Professional 2008

I am following the learning ASP.NET 3.5 by O'REILLY to write some ASP.NET 3.5 code using Visual Studio 2008 SP1. I have gotten to the point to where I need to Configure a Data Source using the SqlDataSource control. I chose Microsoft SQL Server (SqlClient) even though I have SQL Server Express 2005 - This seems like the only logical ch...

What is a good framework for Database Migrations the is compatibile with SQL Server?

I've been spoiled by ActiveRecords. So I'm on the lookout for migration system that can be applied to SQL Server, and either is executed as Java application, or a Win32 Executable. (Of course further compatibility with other DB's and host OS's is welcome.) The real desire is having a clear schema change application with roll back, ide...

How to use GROUP BY to concatenate strings in SQL Server?

How do I get: id Name Value 1 A 4 1 B 8 2 C 9 to id Column 1 A:4, B:8 2 C:9 ...

Is there a way to use Active Directory pass-through security to SQL Server 2005 and disallow types of connectivity, such as ODBC

We have an internal application that is using a service account and fine-grained table and field control is controlled by permissions tables in the application. If we wanted to use pass-through security with Active Directory, we have a problem in that a user with odbc access could modify tables outside of business rules that exist in t...

Real vs. Floating Point vs. Money

Why when I save a value of say 40.54 in SQL Server to a column of type Real does it return to me a value that is more like 40.53999878999 instead of 40.54? I've seen this a few times but have never figured out quite why it happens. Has anyone else experienced this issue and if so causes it? ...

Execute a SSIS package FROM VB.NET or C#

I have a SSIS package that eventually I would like to pass parameters too, these parameters will come from a .NET application (VB or C#) so I was curious if anyone knows of how to do this, or better yet a website with helpful hints on how to do it. So basically I want to execute a SSIS package from .NET passing the SSIS package parameter...