sql-server

Automating DB Object Migrations from Source Control

I'm looking for some "Best Practices" for automating the deployment of Stored Procedures/Views/Functions/Table changes from source control. I'm using StarTeam & ANT so the labeling is taken care of; what I am looking for is how some of you have approached automating the pull of these objects from source - not necessarily StarTeam. I'd l...

What factors could cause the following SqlException: A transport-level error has occurred when receiving results from the server. (provider: Shared Memory Provider, error: 1 - I/O Error detected in read/write operation)

I've started seeing this message intermittently for a few of the unit tests in my application (there are over 1100 unit & system tests). I'm using the test runner in ReSharper 4.1. One other thing: my development machine is a VMWare virtual machine. ...

How to import a DBF file in SQL Server

How can you import a foxpro DBF file in SQL Server? ...

What is the use of the square brackets [] in sql statements?

Hi, I've noticed that Visual Studio 2008 is placing square brackets around column names in sql. Do the brackets offer any advantage? When I hand code T-SQL I've never bothered with them. Example: Visual Studio: SELECT [column1], [column2] etc... My own way: SELECT column1, column2 etc... ...

Best way to search data stored as XML in Sql Server?

Say I have data structures stored as XML (XML data type) within Sql Server. A user wishes to pull out a record if, within the data, a certain string is found. What are my options for implementing this, and which is the best way to do it? Note that each record can have different XML data structures ...

SQL Server Random Sort

What is the best way to sort the results of a sql query into a random order within a stored procedure? ...

In SQL Server, how do I identify *all* dependencies for a specific table using system tables/views?

I am writing a DDL script to drop a number of tables but need to identify all dependencies for those tables first. Those dependencies include foreign key constraints, stored procedures, views, etc. Preferably, I want to programmatically script out dropping those dependencies using the system tables/views before dropping the dependent tab...

Prompt for Database Connection String

I would like to offer a database connection prompt to the user. I can build my own, but it would be nice if I can use something that somebody else has already built (maybe something built into Windows or a free library available on the Internet). Anybody know how to do this in .Net? EDIT: I found this and thought it was interesting: Sho...

How can you unit test a database in SQL Server?

What are some of the ways? What frameworks can you use? ...

SQL Server Freetext match - how do I sort by relevance

Is it possible to order results in SQL Server 2005 by the relevance of a freetext match? In MySQL you can use the (roughly equivalent) MATCH function in the ORDER BY section, but I haven't found any equivalence in SQL Server. From the MySQL docs: For each row in the table, MATCH() returns a relevance value; that is, a similarity mea...

Why is the 'Resource Pool' not supported on the current platform?

What could be the possible causes for the following exception? System.PlatformNotSupportedException: 'ResourcePool' is not supported on the current platform. at System.EnterpriseServices.Platform.Assert(Boolean fSuccess, String function) at System.EnterpriseServices.Platform.Assert(Version platform, String function) at System.E...

Can XpsDocuments be serialized to XML for storage in a database?

And, if not, is the only other alternative a blob? ...

Can a Linq query retrieve BLOBs from a Sql Database?

And how do they come out? ...

Linq to SQL - Accessing System Databases/Tables?

Right now I have an SSIS package that runs every morning and gives me a report on the number of packages that failed or succeeded from the day before. The information for these packages is contained partly within the sysjobs table (a system table) within the msdb database (a system database) in SQL Server 2005. When trying to move the ...

How do I concatenate text in a query in sql server?

SELECT notes + 'SomeText' FROM NotesTable a gives The data types nvarchar and text are incompatible in the add operator. as an error. ...

How do I list user defined types in a SQL Server database?

I need to enumerate all the user defined types created in a SQL Server database with CREATE TYPE, and/or find out whether they have already been defined. With tables or stored procedures I'd do something like this: if exists (select * from dbo.sysobjects where name='foobar' and xtype='U') drop table foobar However I can't find th...

How should I store short text strings into a SQL Server database?

varchar(255), varchar(256), nvarchar(255), nvarchar(256), nvarchar(max), etc? 256 seems like a nice, round, space-efficient number. But I've seen 255 used a lot. Why? What's the difference between varchar and nvarchar? ...

What’s the best way to capitalise the first letter of each word in a string in SQL Server.

What’s the best way to capitalise the first letter of each word in a string in SQL Server. ...

Database engines Comparison - Windows Mobile..

What are the different database options on Windows Mobile available? I have used CEDB and EDB for linear dataset needs. I have heard of SQL server 2005 Mobile edition. But what are the advantages over others (if there is any) ...

In SQL Server is it possible to get "id" of a record when Insert is executed?

In SQL Server 2005 I have an "id" field in a table that has the "Is Identity" property set to 'Yes'. So, when an Insert is executed on that table the "id" gets set automatically to the next incrementing integer. Is there an easy way when the Insert is executed to get what the "id" was set to without having to do a Select statement right ...