sql-server

Code Length vs Organization

I have several nested insert commands. Some of the nested loops share redundant code. Should I make the redundant code its own loop, or create separate instances of the same code within each loop? EXAMPLE (edited for clarification): --Questions 32<->37 SET @index=0 SET @values = 'at your primary grocery store^at WalMart or Sam''s Clu...

How can i link a sql server job name

to the SSRS report server process that uses it? the name looks like a guid, but i need to find the reporting services reports that use it. thanks very much ...

SQL Server Table Synonyms with Indexes

I have multiple databases on a single instance of SQL Server 2005. I've created a synonym on one database to access a table on another database and when writing my queries, I'd like to utilize a specific index, however, when evaluating the execution plan, it doesn't appear to use it. If I write the query to access the database explicit...

Why is READ_COMMITTED_SNAPSHOT not on by default?

Simple question? Why is READ_COMMITTED_SNAPSHOT not on by default? I'm guessing either backwards compatibility, performance, or both? [Edit] Note that I'm interested in the effect relating to the READ_COMMITTED isolation level, and not the snapshot isolation level. Why would this be a breaking-change, as it holds less locks, and stil...

LINQ to SQL Decimal Parameter

I have a very simple linq to sql query in C#: int acctNum = 12345; var query = from p in db.table where p.ACCT_NO == acctNum select p; This generates the following SQL: exec sp_executesql N'SELECT [t0].field1, [t0].field2, [t0].ACCT_NO FROM [dbo].[table] AS [t0] WHERE [t0].[ACCT_NO] = @p0'...

sqlcmd goto isn't quite working—ends script on error

I am using the sqlcmd tool with SQL Server to execute scripts. The scripts add/update records. I need sqlcmd to stop executing and give a non 0 return value if the script throws an error. I thought the following would work but it does not. DECLARE @intErrorCode INT BEGIN TRAN T1; SET IDENTITY_INSERT dbo.SomeTable ON INSERT INT...

MSSQL, Joomla and IIS7

Is there a MSSQL Provider for Joomla? I know that there is a MSSQL Client for PHP in beta and I wonder whether it would be hard to change the database provider to point to MSSQL instead of MySQL. ...

Drupal, SQL Server and IIS7

Is there a SQL Server Provider for Drupal? I know that there is a SQL Server Client for PHP in beta and I wonder whether it would be hard to change the database provider to point to SQL Server instead of MySQL. ...

ODBC problems in SQL 2000 --> 2005 Upgrade

This wiki post outlines both a problem and a solution. I wanted to post this for others that may be having similar problems, as I couldn't find anything specifically to solve this problem elsewhere. We recently upgraded our SQL Server 2000 database to SQL Server 2005. One of the databases on the server is a back-end to a MS Access datab...

What is the easiest way to export a SQLServer 2000 database to XML?

I have an old SQL Server 2000 database that I want to get into XML so I can from there import parts of it into an SQLite database for a PHP website. I've accessed the SQL Server 2000 database via SQL Server Management Studio 2008 Express, I can open all the tables, view the data, etc. I was expecting to be able to e.g. right-click on "...

Make Service Broker Be Less Aggressive About Detecting Poison Messages?

Sql Service Broker uses the following heuristic to determine when you have messages in your queue that are preventing your application from doing any useful work: "Service Broker provides automatic poison message detection. When a transaction that contains a RECEIVE statement rolls back five times, Service Broker disables all queues tha...

best way to migrate tables from MS access to sql server and consolidate

I have a ms access database that has one table for each photo album with the name of the table as the albumname tablename = "Trips" fields: picID, comment i am migrating to sql server and i wanted to fix this normalization issue and just have One table called Albums with albumID and albumName One table called pictures with picID, alb...

Good tutorials for routing a document in Sharepoint

Hi, I would like to know if there are good tutorials for Microsoft Sharepoint. Specifically solutions that involves routing documents for approval. Use of Microsoft Infopath for form making and Microsoft SQL Server for the database is needed. What I meant by good is that the quality that they possess is similar to the video tutorials ...

find a result from a .doc type that store in a varbinary(max) column

Hi friends, i want to write a query with Full-Text-Search on a column with varbinary(max) type that stored a .doc/.docx(MS-Word) file. my query must returns records that contain a word in stored file. is this possible? if yes,how?(please write an example) if yes,can we write that for other language(e.g Arabic,Persian or a UniCode char...

selecting rows from sql server where a casting issue occurs

Hi everyone, i was just wondering if anyone knows how to select rows where a specified column will come under a casting issue. ie. SELECT * FROM ThisTable t WHERE 0 <> ( select cast(t.value as datetime) ) the 'select cast(t.value as datetime)' would ideally return the result of @@error to indicate the casting issue has oc...

Getting 'unhandled token type: unknown token: 0x53' error when connecting to MSSQL using JDBC

I'm getting the following error when trying to connect to a Sql Server (2005) using JDBC: unhandled token type: unknown token: 0x53 Any ideas anyone? I would have liked a more descriptive error too!! Also, I've done the 'telnet servername 1433' test and can confirm that machine can create a TCP connection. ...

MySQL to SQL Server 2005

How can I convert a database from MySQL to MS SQL Server 2005? ...

How to export image field to file?

Hi, I am using Microsoft SQL Server Management Studio to connect to a database. In it I've got a table, one column of which is an Image column containing file data. Another column is a string containing the file name. Is there some way I can write some sql script that will allow me to select a record and write this data to a file? Or i...

Resolving a bug in the TDatasetProvider (the hard way) in Delphi 2010 or Delphi 2009

Hello Folks, Like every year I receive a new Delphi version as SA owner and this is what I do : Install delphi version XX. Run delphi version XX Insert a TSQLConnection component. Connect it to a Microsoft SQL Server 2000 who will be with us at least for six more years. Insert a TSQLQuery with a 'select top 1 * from myTable' which is...

Get Updated Row

I have a query that updates one record, and only one record. Is there are way to get the Id updated in the same query such as Select ScopeIdentity when inserting. UPDATE Task SET MyTime = GetDate(), MyUserId = @userid FROM (select top 1 table where SomeStuff) Select Lastrow that just got updated. ...