sql-server

Are Microsoft "Express" editions free to develop on?

Am I able to develop software for free on MS SqlServer 2005/2008 Express edition databases? ...

MySQL or SQL Server better for an Enterprise application?

I am developing a big application using PHP. Is MySQL or SQL Server the best one to use? ...

Need select query

Consider the following table structure with data - AdjusterID | CompanyID | FirstName | LastName | EmailID ============================================================ 1001 | Sterling | Jane | Stewart | [email protected] 1002 | Sterling | David | Boon | [email protected] 1003 | PHH ...

How to speed up a massive update to the clustered column?

I have a pretty large table: 20+ million rows and I need to update about 5% of that - or 1 million rows. Unfortunately, I am updating the (int) column that is being used as the clustered index. My question is: What is the fastest way to update these rows? I have tried updating the rows directly: update t1 set t1.groupId = t2.groupId...

How can I concatinate a subquery result field into the parent query?

Hi folks, DB: Sql Server 2008. I have a really (fake) groovy query like this:- SELECT CarId, NumberPlate (SELECT Owner FROM Owners b WHERE b.CarId = a.CarId) AS Owners FROM Cars a ORDER BY NumberPlate And this is what I'm trying to get... => 1 ABC123 John, Jill, Jane => 2 XYZ123 Fred => 3 SOHOT J...

SQL Error handling

Hi there, Can you tell me if error handling is worth putting into this stored procedure? -- ********************************************** -- Delete and create a new 'Truncate' function... -- ********************************************** IF EXISTS(SELECT name FROM sysobjects WHERE name = 'truncate_description...

Executing a SQLCommand Without Specifiying a Transaction

Hi, I feel like I should be able to find the answer to this question but for the life of me I can't seem to get the information I'm looking for. We have some lists of data being fetched in our application via a SqlCommand performing a SELECT query on a SqlServer database. We do not explicitly setup a transaction on the SqlCommand, ins...

SQL Server SELECT statements causing blocking

We're using a SQL Server 2005 database (no row versioning) with a huge select statement, and we're seeing it block other statements from running (seen using sp_who2). I didn't realise SELECT statements could cause blocking - is there anything I can do to mitigate this? ...

Most efficient way to auto-hookup a foreign key in LINQ

I have two tables for tracking user sessions on my site. This is a gross oversimplification btw : Campaign: campaignId [int] campaignKey [varchar(20)] description [varchar(50)] Session: sessionDate [datetime] sessionGUID [uniqueidentifier] campaignId [int] campaignKey [varchar(20)] ...

Distributed transaction aborted by MSDTC.

how to resolve the error 8522 in sql server 2005. I'm working with two servers.every time when i have to work i have to fetch live data from the server that is at remote place. I fetch that live data onmy local server and work. form last threemonth it was working fine but now its giving following error. Distributed transaction abor...

sql server 2008 retain last open databases

I use around 3 sql server 2008 databases. everytime I need to query on a database, I need to login to that db and then qery. is there a way to retain the last opened database in sql server 2008? as an analogy, think this is like firefox allowing to display the last open websites. ...

Should I use a SQL Server keyword as a column name?

I am designing a database and recently named a column in a table DayOfWeek, completely forgetting that DayOfWeek is a built-in function in SQL Server. Now I am deciding if I should just leave it as is and reference the column with square brackets [DayOfWeek] or change the column name to avoid any conflicts in the future. I am not too f...

I want to install SQL Server 2008 Enterprise and SQL Server 2008 Express on the same machine, which should I install first?

I want to install SQL Server 2008 Enterprise and SQL Server 2008 Express side-by-side on the same machine, which should I install first for a simpler install process and easier maintenance in future? ...

SQL Server group by concatination query help

I have a need for a "run once" query (so performance isn't that critical), using tables similar to these (simplified versions of the actual): CREATE TABLE #Items ( ItemPK int not null primary key ,ItemDescription varchar(25) not null ) INSERT INTO #Items VALUES (1,'rock') INSERT INTO #Items VALU...

How to replace all non-sequential GUIDs with sequential ones?

I have a brown-field SQL Server 2005 database that uses standard, unsorted GUIDs as the majority of the primary keys values and also in clustered indexes (which is bad for performance). How should I go about changing these to sequential GUIDs? One of the challenges would be to replace all of the foreign key values as I change each the ...

Filtering out children in a table with parentid

Hi, I need a bit of help constructing a query that will let me filter the following data. Table: MyTree Id ParentId Visible ===================== 1 null 0 2 1 1 3 2 1 4 3 1 5 null 1 6 5 1 I expect the following result from the query: Id ParentId Visible ===================== ...

Basic Questions about SQL Server Compact Edition 3.5

1) Is SSCE (SQL Server Compact Edition) a local only database? Meaning I can't access it from anywhere else but the host machine? 2) It supports up to 256 connections locally? 3) Are there any good tools available for converting an empty mdf with no stored procedures or triggers to a CE sdf? 4) When you run the install for this, does ...

Private Key issue in Service Broker

We are trying to make conversation between two SQL instances in one SQL Engine through Service Broker by following tutorial from MSDN. In order to make it simple , we send the dialog with Encryption = OFF so we do not need to deal with Master key , Certificate... and it works in the local workstation. DECLARE @InitDlgHandle UNIQUEIDEN...

The concurrent snapshot for publication 'xx' is not available because it has not been fully generated or the Log Reader A

I am having all sorts of trouble getting SQL Server (2005) to work properly. When I run the client (SQL Server Express 2005) I get the following error "The concurrent snapshot for publication 'xx' is not available because it has not been fully generated or the Log Reader A" The error is cropped off. I have tried: - Deleting the subsc...

Which data type to use for ordinal?

Whenever I have some records/objects that I want to be in a certain order, I usually create a field called Ordinal. I often wonder if it would be better to use an integer or a decimal value for the ordinal field. This is a consideration when moving an object to a different position in the order: If you use consecutive integers, you h...