sql-server-2008

Most efficent way to merge data into SQL Server database from ODBC source

I need to constantly merge (upsert/delete) data from an ODBC data source to a SQL Server 2008 database (number of rows vary from one row to 100000 of rows) What would you recommend as the most efficient approach (using .net 3.5 ): Use SqlBulkCopy into temp table then call stored procedure with Merge command using temp table as sour...

Sql sever fulltext search does not return all the results

I tried to use full text search for a table called "Business" in Sql sever 2008 here is the statement(the search term is in chinese) select * from Business biz where CONTAINS(biz.*,'家具') And the I use like statement to do the same select * from Business where Name like '%家具%' The Fulltext searc returns 8 results and the like searc...

Bulk insert using stored procedure

I have a query which is working fine: BULK INSERT ZIPCodes FROM 'e:\5-digit Commercial.csv' WITH ( FIRSTROW = 2 , FIELDTERMINATOR = ',', ROWTERMINATOR = '\n' ) but now I want to create a stored procedure for it. I have written below code to make its stored procedure: create proc dbo.InsertZipCode @filepath varcha...

Filter union result

Hi, Im making select with union. select * from table_1 union select * from table_2 ... Is it possible to filter query result by column values ? thanks for help ...

WHERE IN Question

I have a couple of Tables already supplied in the form MainRecord Record ID Details Textual Information 1 AAAAAAA ... some text referring to Oxford St Giles... 2 BBBBBBB ... some text referring Oxford.... 3 CCCCCCC ... some text referring to Oxford St Aldate... and supporting table Pl...

SQL : What is a Clustered Index Scan, why/when it is it used?

SQL Server 2008 Looking at execution plan says Clustered Index Scan taking up 70%, Why? What is it? ...

sql-server-2008: how do i sort the results of a procedure?

i am running: exec sp_who go is it possible for me to sort by a field like: exec sp_who order by dbname go ? i would i accomplish this? ...

Which Express Edition to go with: SQL Server 2005 or 2008 R2?

For migrating my old database from MySQL to SQL Server, which edition is suitable, 2005 or 2008 R2? Some developers suggested me to stick to the old version. Suggest Pros and Cons. I will be using with my .NET standalone Windows app. ...

Very slow request on temporary table

On my MS SQL Server 2008, I've created a temporary table like this : create table #test ( A varchar(50), B int, ) insert into #test select 'a',45 insert into #test select 'b',587 insert into #test select 'a',4 insert into #test select 'b',58 Now the following request take forever select A,SUM(B) from #test group by A -- takes 4 seco...

sql server 2008: setting default location for mdf/ldf

When I create a new database, by default the files are saved to c:\program files... but I would like them by default to be saved into a different location WITHOUT having to adjust anything. Is there a way to have this done by default? Perhaps there's some stored system procedure that I would have to change? ...

How can I tell *IF* AND *WHAT* partitions are being accessed - sql server 2008 db engine

Setup Cost of Threshold for Parallelism : 5 Max Degree of Parallelism : 4 Number of Processors : 8 SQL Server 2008 10.0.2.2757 I have a query with many joins, many records. The design is a star. ( Central table with fks to the reference tables ) The central table is partitioned on the relevant date column. The partition schema is spl...

Duplicate results returned from query when distinct is used

On a current project at I am needing to do some pagination of results returned from SQL. I have hit a corner case in which the query can accept identifiers as part of the where clause, normally this isn't an issue but in one case we have a single identifier being passed up that has a one to many relationship with one of the tables that t...

datetime2 and ProviderManifestToken in Entity Framework

I have an MVC app using Entity Framework and a SQL 2008 DB. I used the EF wizard to generate my data model. I have a SQL table with a standard SQL DateTime column. The EF model is using System.DateTime. But when I try to insert a new record into this table from my application, without specifying a value for this DateTime column, I ge...

exporting data from table in sql server to access?

Greetings i wana know how can i export data from a table to access through a sql job i am using sql server 2008 and office 2007 ...

Adding a reference data to the table column from different table line

I have an event table with following columns: sequence (int) DeviceID (varchar(8)) time_start (datetime) DeviceState (smallint) time_end (datetime) All columns except time_end are populated with the data (my current time_end column is NULL through out the table). What I'd need to do is to populate the time_end column with the event c...