sql-server

Best/fastest compression format for (sqlserver) databases?

Has anyone found a good compression format for MS Sqlserver databases? If so, what do you use and are you pleased with how it performs? My company frequently will compress a database snapshot from one of our clients and download it so we have a local copy for testing and dev purposes. We tried zip in the past, but once the database fil...

What are some references, lessons and or best practices for SQL optimization training.

I know this falls into the black arts area of programming, but this is suddenly an area that I need to strengthen in my professional life. There are a couple of topics were this subject has been touched on but I'm not sure the item has been really addressed about how to become one with the system. For example: I became a phenomenally b...

What's the fastest way to bulk insert a lot of data in SQL Server (C# client)

I am hitting some performance bottlenecks with my C# client inserting bulk data into a SQL Server 2005 database and I'm looking for ways in which to speed up the process. I am already using the SqlClient.SqlBulkCopy (which is based on TDS) to speed up the data transfer across the wire which helped a lot, but I'm still looking for more. ...

Select existing data from database to create test data

I have a SqlServer database that I've manually filled with some test data. Now I'd like to extract this test data as insert statements and check it in to source control. The idea is that other team members should be able to create the same database, run the created insert scripts and have the same data to test and develop on. Is there a...

Effectively Converting dates between UTC and Local (ie. PST) time in SQL 2005

What is the best way to convert a UTC datetime into local datetime. It isn't as simple as a getutcdate() and getdate() difference because the difference changes depending on what the date is. CLR integration isn't an option for me either. The solution that I had come up with for this problem a few months back was to have a daylight sav...

Can DTS Test for Presence of MS-Access Table

I have an Access database in which I drop the table and then create the table afresh. However, I need to be able to test for the table in case the table gets dropped but not created (i.e. when someone stops the DTS package just after it starts -roll-eyes- ). If I were doing this in the SQL database I would just do: IF (EXISTS (SELECT ...

SQL Server Device or User CAL

Can you please explain the difference between MS SQL Device and User CAls. I need the MS SQL Server for an intranet website, how do I assess whow many license I need and what type? ...

VBScript/ASP Classic

I have a couple of questions regarding VBScript and ASP Classic: 1) What is the preferred way to access an MS SQL Server database in VBScript/ASP? 2) What are best practices in regards to separating model from view from controller? 3) Any other things I should know about either VBScript or ASP? If you haven't noticed, I'm new at V...

Incosistency between MS Sql 2k and 2k5 with columns as function arguments

I'm having trouble getting the following to work in SQL Server 2k, but it works in 2k5: --works in 2k5, not in 2k create view foo as SELECT usertable.legacyCSVVarcharCol as testvar FROM usertable WHERE rsrcID in ( select val from dbo.fnSplitStringToInt(usertable.legacyCSVVarcharCol, default) ) ...

What are the advantages and disadvantages of turning NOCOUNT off in SQL Server queries?

What are the advantages and disadvantages of turning NOCOUNT off in SQL Server queries? ...

Is there a way to make a TSQL variable constant?

Is there a way to make a TSQL variable constant? ...

MS SQL Server 2008 "linked server" to Oracle : schema not showing

I have a Windows 2008 Server (x64) running Microsoft SQL 2008 (x64) and I'm creating a Linked Server connection to an Oracle server. I'm able to make the connection, but I cannot see any information regarding which schema a table belongs to. In SQL 2005, my linked servers show the schema information as I would expect. Does anyone know...

What is the best way to deal with DBNull's

I frequently have problems dealing with DataRows returned from SqlDataAdapters. When I try to fill in an object using code like this: DataRow row = ds.Tables[0].Rows[0]; string value = (string)row; What is the best way to deal with DBNull's in this type of situation. ...

New Project : MySQL or SQL 2005 Express.

I am starting a new client/server project in work and I want to start using some of the newer technologies i've been reading about, LINQ and Generics being the main ones. Up until now I have been developing these types of applications with MySQL as clients were unwilling to pay the large licence costs for MSSQL. I have played around ...

Timeout not being honoured in connection string

I have a long running SQL statement that I want to run, and no matter what I put in the "timeout=" clause of my connection string, it always seems to end after 30 seconds. I'm just using SqlHelper.ExecuteNonQuery() to execute it, and letting it take care of opening connections, etc. Is there something else that could be overriding my ti...

Does MS-SQL support in-memory tables?

I've grown up as a programmer using MySQL all the way. Recently, I started changing some of our applications to support MS SQL Server as an alternative backend. One of the compatibility issues I ran into is the use of MySQL's CREATE TEMPORARY TABLE to create in-memory tables that hold data for very fast access during a session with no ne...

What's the difference between a temp table and table variable in SQL Server?

In SQL Server 2005, we can create temp tables one of two ways: declare @tmp table (Col1 int, Col2 int); or create table #tmp (Col1 int, Col2 int); What are the differences between the two? I have read conflicting opinions on whether @tmp still uses tempdb, or if everything happens in memory. In which scenarios does one out-perf...

SQL Server - testing the database

What tools are people using for testing SQL Server databases? By this I mean all parts of the database - configuration, tables, column type, stored procedures, constraints. Most likely, there is no one tool to do it all. ...

use table metadata for select statement in SQL Server?

I have a large database and would like to select table names that have a certain column name. I have done something like this in MySQL, but can't find any info on SQL Server. I want to do something like: select [table] from [db] where table [has column 'classtypeid'] how can I do something like this? ...

SQL Server to MySQL

I have a backup of an SQL Server DB in .bak format which I've successfully managed to restore to a local instance of SQL Server Express. I now want to export both the structure and data in a format that MySQL will accept. The tools that I use for MySQL management typically allow me to import/export .sql files, but unfortunately Microsoft...