sql-server-2005

SQL Server: How to abort a series of batches in Query Analyzer?

i have a series of T-SQL statements separated by the special Query Analyzer batch separator keyword: GO If one batch fails, i need Query Analyzer to not try subsequent batches - i want it to stop processing the series of batches. For example: PRINT 'This runs' go SELECT 0/0, 'This causes an error' go PRINT 'This should not run' go...

Incrementing value based on criteria in a single database query

I have a table which has a column labeled 'sortorder' which is used to allow customer to manually change the order of each item. The table also has a column labeled 'CategoryId'. I was curious, if I was bulk importing a set of data in which I knew all data, including CategoryId, how I could specify the incrimenting value for 'SortOr...

Find size of multiple databases in SQL Server 2005

I was wondering if there is a sql statement to get the current size of all the databases on your server instead of right clicking and going to properties for each one. ...

Openquery works much faster than a query straight to a linked table

Trying to figure out why there is such a significant difference between select * from linkedserver..tablename and select * from openquery(linkedserver, select * from tablename). 4 minutes vs 13 seconds. ...

Populate ParameterCollection w/ sp_columns (or INFORMATION_SCHEMA.Columns) Results

I'd like to build a ParameterCollection object based on the results of either execute sp_columns MyTableName or SELECT * FROM INFORMATION_SCHEMA.Columns WHERE TABLE_NAME = 'MyTableName'. The problem I'm having is assigning the appropriate data type to each Parameter ... I'm unsure of how to gather that information from either of the abo...

how to solve deadlock problem?

i have read this dead lock problem When database tables start accumulating thousands of rows and many users start working on the same table concurrently, SELECT queries on the tables start producing lock contentions and transaction deadlocks. Is this deadlock problem related with TransactNo updlock? If you know this problem, let me kn...

SQL Server 2005 restore one schema only

I am pretty sure this isn't possible.... We have a database with several schemas. Each schema belongs to a different user. One user was asking "if I find out I made a whole load of errors would it be possible to revert to the state my data was in yesterday". Obviously we could restore the whole database, but that would restore the other...

Returning Multiple Collections in SubSonic

I have a Collection on Menu Sections which each contain a collection of Menu Items (it's a two-tier menu, simple stuff). Ideally I could deepload the MenuSection collection to grab the MenuItems atthe same time, but failing that, is there a way that I can return a separate Collection of each using only one database call via subsonic? Am ...

WPF SQL Distributed Data Model with LINQ and SQL Express

I am developing an application in C#/WPF that requires a distributed data model, as it will have both online and offline access. My current thoughts are to develop the first version of the application against SQL Server express and LINQ to SQL. Then use the schema to create a SQL Express Compact DB (and modify the connection string) for...

concatenate rows from a select statement

I have a select statement which is something like this select col1 from table1 where cond1=true This returns results like col1 _____ 5 5 6 3 but I want to change it to return me 5-5-6-3 Is this possible? If so how? Please let me know how to do this. Thanks in advance for your replies. ...

guid Primary Key creation for the fastest query select where guid in ( guid1, guid2 , guid3 ...)

There is a requirement to use GUID(s) as primary keys. Am I right in thinking that ProductID UNIQUEIDENTIFIER NOT NULL ROWGUIDCOL DEFAULT (NEWSEQUNTIALID()) PRIMARY KEY CLUSTERED will give the fastest select for where clause productid in ( guid1 , guid2 ,..., guidn ) and doesn't deteriorate non-clustered natural_key like 'Some...

How can I transform database from sql server 2005 to 2000

how can I transform database from sql server 2005 to 2000 ...

size limit for XML datatype in SQL 2005

Is there a size limit on the XML data type in SQL 2005? When I try to return anything more than 44kb size of the XML string from my stored proc, it just returns an empty string. I am using FOR XML PATH to return hierarchical data sets in XML format from my stored procs. ...

How to look for a SQl Server row based on a paragraph - specifically, the words in the paragraph, not the exact paragraph

I want to use SQL Server 2005 Express to find the top five tuples related to a paragraph of text. I know I can use Full Text Indexing and CONTAINSTABLE to find rows that contain an exact phrase, but how do I get it to return the closest matches to the words in a paragraph, not the exact paragraph itself. So far the only way I can think...

How do I add domain account users to SQL Server 2005 Windows Authentication List?

We recently moved from one domain to another and now I am trying to figure out how to tell SQL Server to authenticate the users in the new domain to log onto our SQL database. We use SQL Server 2005. ...

Passing multiple parameters of same column to SQL Server select SP

I have a string value in the web.config for example 2 guids separated by a ",". I need to query the database dynamically (i.e i have no idea how many values could be separated by a comma in the web.config) and run a select statement on the table passing these values and getting all that is relevant for example: select * from tablename...

Does a trigger on update, that updates its own table, recall the trigger?

I have a table called Point. The table has two columns that we'll deal with, ActualDepth and DesignDepth. When someone updates ActualDepth I have a trigger that will recalculate the DesignDepths for all of the other points that are near the updated one. My question then is, Will my trigger be called recursively because other rows in...

SSRS Interactive Viewer formatting problem

I have an SSRS report with 2 sub-reports that had been working fine. Recently I added some additional table sections to the report and I started seeing and issue when the report was displayed in the interactive viewer. The data is fine but the formatting on the last 2 table sections does not appear in the veiwer. The formatting actual...

SQL Server Management Studio - using multiple filters in table list?

In Management Studio, you can right click on the tables group to create a filter for the table list. Has anyone figured out a way to include multiple tables in the filter? For example, I'd like all tables with "br_*" and "tbl_*" to show up. Anyone know how to do this? Thanks ...

SQL Server 2005 Service Pack 3 won't install.

Already on Server Fault SQL Server 2005 Service Pack 3 won't install I am trying to install SQL Server 2005 Service Pack 3 and it keeps failing. Comes back with the following: Microsoft SQL Server 2005 - Update 'Service Pack 3 for SQL Server Database Services 2005 ENU (KB955706)' could not be installed. Error code 1603. The det...