SQL Server 2005 implementation of MySQL REPLACE INTO?

MySQL has this incredibly useful yet properitary REPLACE INTO SQL Command. Can this easily be emulated in SQL Server 2005? Starting a new Transaction, doing a Select() and then either UPDATE or INSERT and COMMIT is always a little bit of a pain, especially when doing it in the application and therefore always keeping 2 […]

Upload CSV file to SQL server

What is the best way to upload a large csv data file into SQL server using C# ? The file contains about 30,000 rows and 25 columns.

Should I get rid of clustered indexes on Guid columns

I am working on a database that usually uses GUIDs as primary keys. By default SQL Server places a clustered index on primary key columns. I understand that this is a silly idea for GUID columns, and that non-clustered indexes are better. What do you think – should I get rid of all the clustered […]

SQL Server 2008 Insert with WHILE LOOP

I have existing records like ID Hospital ID Email Description 1 15 abc@e.com Sample Description 2 15 def@dd.com Random Text I need to use a WHILE loop to insert rows with Hospital ID changing to a specific value or 32 in this case, while the others(not ID as it is auto generated) remaining constant. It […]

How do you open an SDF file (SQL Server Compact Edition)?

I have an SDF file and I would like to retrieve its schema and query it with some UI. How can I do this? I have no Visual Studio installed on the machine and I would like to install as little software as possible.

How can I create a SQL unique constraint based on 2 columns?

I have a Table like this one: |UserId | ContactID | ContactName ————————————— | 12456 | Ax759 | Joe Smith | 12456 | Ax760 | Mary Smith | 12458 | Ax739 | Carl Lewis | 12460 | Ax759 | Chuck Norris | 12460 | Bx759 | Bruce Lee I need to add a constraint to […]

Updating Data Provider of Crystal Reports

I have created number of Crystal Reports in My VB.NET Project getting data from Microsoft Access 2007 (.accdb) Database. Now, I am updating My Application with Microsoft SQL Server (.mdf)Database. How Can I Update the Data Source From Access Files To MDF Files For All of My Crystal Reports? Thanks.

How to connect to Microsoft SQL Server 2008 (MSSQL) from Matlab?

This is probably a simple question: How do I connect to Microsoft SQL Server 2008 R2 from Matlab? How do I read a table into a matrix given some SQL query? Update I’d prefer a method that doesn’t require use of manual setup using ODBC.

How to sum up time field in SQL Server

I have a column called “WrkHrs” and the data type is time(hh:mm:ss). I want to sum up the working hours for employees. But since it’s time data type sql server doesn’t let me use like sum(columnname). How can I sum up the time data type fieled in sql query?

What is the command to truncate a SQL Server log file?

I need to empty an LDF file before sending to a colleague. How do I force SQL Server to truncate the log?

MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.