sql-server-2008

SQL Server job to check 2 databases and act based on result?

I need to check 2 tables on similar databases on different servers, if they contain the same information (or size, hash, whichever is the best way to check if they're the same) then one of them should have its information deleted, on a scheduled job every day. Is this possible using only the Jobs interface from within SQL Server Managem...

Sql client transactions from code vs database-controlled transactions

I've always done transactions from within stored procedures but now I need to wrap a bunch of "dynamic" statements executed from code against sp_executesql in a transaction. Specifically I need the READ UNCOMMITED isolation level for these in some cases (I know what that does, and yes, that's what I need). This is SQL2008. My question ...

Reading from Linked Server and deleting on local DB

Hi, I have 2 similar tables on different databases. I already linked the remote DB and set it's data access to 'True'. However I can't get the following query to work GO USE LOCALDB GO DELETE from [dbo].[TableA] WHERE [dbo].[TableA].[UniqueField] = (SELECT [UniqueField] FROM [REMOTESERVER].[REMOTEDB].[dbo].[TableA]) GO This query d...

How to put SQL data in a chart in Silverlight

I was wondering if anyone knew where I could find some information on how to get some data from a SQL database into a ColumnSeries chart in Silverlight-4.0/C#-4.0. I have tried Googling this and I cannot find anything that describes this process at all. Is it just a matter of giving it a path or something in the "ItemSource" property? ...

Why is SQL server not using my index? (Filtering over joined indexed views)

I have two indexed views, v_First and v_Second. These views work great when I have a WHERE clause that filters only based on one of these views, however as soon as I have filter criteria based on both views I get two clustered index scans and poor performance as a result. My query is: SELECT * FROM dbo.v_First (NOEXPAND) JOIN dbo.v_Se...

When to use recursive table

Hi All, I have a need to build a schema structure to support table of contents (so the level of sections / sub-sections could change for each book or document I add)...one of my first thoughts was that I could use a recursive table to handle that. I want to make sure that my structure is normalized, so I was trying to stay away from deo...

Import selected columns from a CSV files to SQL Server table

Hi, I am trying to import data from a CSV file to a SQL Server 2008 table. Data upload is working, but I want to import only selected columns, not all, and add them to a a new table, of same no. of columns, using the wizard, but its not happening, the wizard is selecting all the columns. So is it possible using wizard that I only impor...

Passing table variable into dynamic SQL 2008

I need to run a dynamic sql which uses table variable created in the scope of the parent. How do I pass table variable into dynamic sql in SQL2008 ? ...

Service Broker : Sys.Conversation_endpoints filling up with CO/CONVERSING messages when using With Cleanup

We recently identified a problem with one of our databases where as a result of a 'fire & forget' setup (i.e: conversations being closed immediately after sending), our sys.conversation_endpoints table was filling up with DI/DISCONNECTED_INBOUND messages. This eventually spilled over into the tempDB, causing it to grow enormously and eat...

Conditional Check in Where clause

i have a procedure in which the below condition is to be written in a WHERE clause. How do I do that. itemid is a parameter which can be null. if itemid is available then add it to my where clause,else do nothing ...

Using MS SQL Server on Snow Leopard Server with Coldfusion

I was wondering if it was possible or is there a way of using that all together on one machine without virtualization ...

SQL Server 2008- Keywords

Hi I've looked everywhere for an answer and cannot find one. I was reading an sql tutorial which used the keyword EXPLAIN to see how a query is executed. I tried the in SQL Server 2008 with no success. So my question is. What word would I use to get the equivelant result? Thank you in adv. ...

The SELECT permission was denied on the object 'Notes', database 'Sticky', schema 'dbo'.

It appears here: SyncAdapter notesSyncAdapter = notesBuilder.ToSyncAdapter(); ((SqlParameter)notesSyncAdapter.SelectIncrementalInsertsCommand.Parameters["@sync_last_received_anchor"]).DbType = System.Data.DbType.Binary; ((SqlParameter)notesSyncAdapter.SelectIncrementalInsertsCommand.Parameters["@sync_new_rec...

Full Text Search Exact Match - in binaries

I have a query that is running something like this in SQL Server 2008 Select [key], Rank From ContainsTable(tblDocuments, '"Exact Match"') At the time we decided to use SQL FTS Exact Matching wasn't a requirement; sadly requirements move on and now we are interested in the possibility of getting exact matches too - i am not in a place...

Continuously updating data in application from database

Hello, I am writing an application that needs to continuously update its displayed data from a view in a database. Currently, it is periodically polling the entire data set and redisplaying it. I am changing it to be more efficient and am interested in people's opinions on how to do this most effectively. The application is a Windows Fo...

Exclude .LOG file while restoring a database

Hi I have a database backup file (MyDatabase.bak). When restoring the database through SSMS it gives me "Not enough space on disk" message. I looked for an option to exclude .LOG file from restore but could not find one. I even tried to remove the "MOVE .LOG" from restore query but got an error message "could not find .LOG file use WI...

passing list of name/value pairs to stored procedure

I have a name/value pair in a List<T> and needing to find the best way to pass these to a stored procedure. Id Name 1 abc 2 bbc 3 cnn .... ... What is the best way to accomplish this? ...

Storing Some SQL Server Data Offline

I am beginning to design a new laboratory test data management system with many (about 30) test stations. The system must be able to collect data offline in the event of a network outage. Each station would keep an up-to-date, read-only copy of test structures (specifications, entity types, business rules/workflows, etc) but not test d...

SQL Syntax error on one machine but not the other

I have a legacy web-site that I am maintaining (built mostly in classic ASP with vbscript). I am making some modifications to it, and got tired of waiting 5 minutes everytime I had to go through one of the pages that was loading 99000 records from the database before displaying the first 20 of them, so I rewrote the code as: sSQL = "WIT...

Why Non null values in Sparse columns takes extra space in SQL Server 2008

Hello Guys, May I know why Sparse columns which are having non null values takes 4Bytes of extra space..I am finding out why it is taking 4 bytes of extra space.. Please help me out? ...