sql-server-2005

Does an insert made in a transaction is visible by SELECT before transaction is commited

I need a confirmation. Client 1 insert rows in a table inside a transaction. Client 2 request this table with a SELECT. If on this client isolation level is set to READ COMMITTED, can you confirm that the SELECT won't returns the rows that aren't yet committed by Client 1. Thanks ...

Variable as numeric sent to stored procedure (SQL Server 2005)

I see that with SQL Server 2005 you can pass a parameter as numeric e.g. create procedure dbo.TestSP @Param1 numeric as But what does this equate to? E.g. Numeric(10,0), Numeric(9,2), etc? We have some Developers here who are using this instead of the correct definition for the field that this parameter is going to be used agains...

Getting XQuery [modify()]: Top-level attribute nodes are not supported error while modifying xml

DECLARE @mycur CURSOR DECLARE @id int DECLARE @ParentNodeName varchar(max) DECLARE @NodeName varchar(max) DECLARE @NodeText varchar(max) SET @mycur = CURSOR FOR SELECT * FROM @temp OPEN @mycur FETCH NEXT FROM @mycur INTO @id,@ParentNodeName,@NodeName,@NodeText WHILE @@FETCH_STATUS = 0 BEGIN PRINT @id -- sample statements PRINT @Pare...

Why would you Truncate immediately before Dropping a temp table?

I see some code where the author has truncated a temp table immediately before dropping the temp table. Is there a reason for doing this? TRUNCATE TABLE #Temp DROP TABLE #Temp ...

How to store large string data into s SQL Server 2005 data base?

Hello Experts, I have 100000 Ids to store into our DataBase. Id is in string format.each id contain 10 char. So what is the best data type is for this data? I have been used vrchar(max), text but my problem is not solved. So please experts help me. ...

Boolean logic parser for SQL

This is going to sound crazy but does anyone have techniques that would allow me to parse boolean logic strings in Sql Server 2005 without extraordinary/rediculous effort? Here is an example: (SOMEVAR=4 OR SOMEVAR=5) AND (NOT OTHERVAR=Y) I feel like recursion would help a lot if that were possible in Sql but I'm not really sure how to ...

SQL. Sorting by a field

I have created a simple view consisting of 3 tables in SQL. By right clicking and selecting Design, in the Object explorer table, i modified my custom view. I just added sortby asc in a field. The problem is that the changes are not reflected in the outout of the View. After saving the view, and selecting Open view the sort is not disp...

Replication: SQL Server 2008 Publisher with SQL Server Express 2005 Subscriber

Here is the setup: SQL Server 2008 Enterprise Server with a Merge Publication. SQL Server 2005 Express with pull subscription. There is no web or ftp setup. This is direct merge replication. Using the RMO objects from C#, I get a "class cannot be found." COM Error when accessing the MergePullSubscription.SynchronizationAgent prope...

I need a query designed for MySQL translated to work for SQL Server 2005

I've spent a whole day on this already without figuring it out. I'm hoping somebody can help me translate the following MySQL query to work for SQL Server 2005: SELECT MAX ( messages.date ) AS maxdate, topics.id AS topicid, topics.*, users.* FROM messages, topics, users WHERE messages.topic_id = topics.id AND topics.user_id = user...

Better way to write this SQL

I have the following table: create table ARDebitDetail(ID_ARDebitDetail int identity, ID_Hearing int, ID_AdvancedRatePlan int) I am trying to get the latest ID_AdvancedRatePlan based on a ID_Hearing. By latest I mean with the largest ID_ARDebitDetail. I have this query and it works fine. select ID_AdvancedRate...

Convert SQL Server 2000 to 2005

I have a SQL Server 2000 database and I want to convert it to SQL Server 2005 ...

SQL: Recursively get parent records using Common Table Expressions

Hi there, Suposse you have to following tables where a sale consists of products and a product can be placed in multiple categories. Whereby categories have a hierachly structure like: Man Shoes Sport Casual Watches Women Shoes Sport Casual Watches Tables: Sale: id name 1 Sale1 Product: id saleidfk name ...

SQL to retrieve aggregated data with computed columns

I have a table that looks like this for about ~30 students: StudentID Course* CourseStatus 1 Math Pass 1 English Fail 1 Science Pass 2 Math Fail 2 English Pass 2 Science Fail etc. *In my actual database the 'Course' column is ...

The new SSIS in SQL2005/SQL2008 are oversized

I studied the new MERGE Statement and there is a nice example for importing a flatfile. INSERT <Table> SELECT * FROM OPENROWSET BULK <Import-Flat-File>, <Format-File>... seems to be a good replacment for such a simple job and avoids to build a SSIS-Package. EXEC XP_CMDSHELL bcp <Table or View> out <Flat-File> ... is almost simpler ...

Multi table Triggers SQL Server noob

I have a load of tables all with the same 2 datetime columns (lastModDate, dateAdded). I am wondering if I can set up global Insert Update trigger for these tables to set the datetime values. Or if not, what approaches are there? Any pointers much appreciated ...

Filling the missing gaps(Sql Server 2005) [Set based using recursive CTE]

I have a table MissingData 1 10 NULL NULL 22 NULL The desired output will be MissingData 1 10 10 10 22 22 i.e. the nulls will be filled up by the previous value until a new value is appearing. I can solve this by using loop but my requirement is to solve it by CTE in which I am not so comfortable as of now. Thanks ...

Update column using rows of a table, without using cursor or any other iteration.

Update Combined column using CategoryCode of every OrderId. In this example there are two OrderIds 990 and 986. Need to concatenate categories of these two individually. The desired result is like this. 990 Bus, Pub, Shoot, Club, Bus, Hos Thanks. ...

Necessary rights to be able to add a column with ALTER TABLE ADD column_name

Hi, Could somebody point out the necessary rights to do something like ALTER TABLE myTable ADD myColumn int NOT NULL CONSTRAINT [Constraint_name] DEFAULT ((0)) ? I assumed grant alter on myTable to [user] was enough but I'm getting the error message The UPDATE permission was denied on the object 'myTable', database 'x', schem...

How do I remove duplicate SQL Server 2008 instances after upgrading from SQL Server 2005?

I've just upgraded an existing SQL Server 2005 to 2008 by running the installer (not the platform installer). It all seems to have worked - there were no errors reported and my code that connects to these databases still works fine. The problem is, when I try installing SQL Server Management Studio Express 2008 I am shown the following ...

How can I manage SQL CE databases in SQL Server Management Studio?

Dear all, I have Sqlserver 2005 Express Edition only. and VS 2005. How to i create my .sdf file. and how to create tables in that file... I am developing a SmartDevice Application. if any possible to access the Sql server 2000 DataBase without using .SDF file. Note: in my system i have VS 2005, SQL SERVER 2000, SQL SERVER 2005 Express...