sql-server-2005

Has anyone ever seen this SQL Server Error? Failed Assertion = 'm_iteratorInSafeState'. I can't find anything online to help.

We have a client running our .NET application which connects to SQL Server 2005 on the backend. A few weeks ago the database crashed and the whole server had to be rebooted. This happened again today and I got the log file from their DBA which seriously offered no clue as to what's really going on. I searched on Google and Bing and onl...

How to call a CLR Stored Procedure from codebehind of an aspx page?

Hi all How to call a CLR Stored Procedure from codebehind of an aspx page? I am using SqlCommand with commandtext as CLR Stored Procedure name and SqlHelper.ExecuteDataSet() as below. string connectionString = ConfigurationManager.AppSettings["ConnectDB"]; SqlConnection sn = new SqlConnection(connectionString); SqlParameter[] sqlPar...

Alter column drops index

I have a table CREATE TABLE table1( [classe] [char](30) NOT NULL, [code] [char](30) NOT NULL, [description] [varchar](255) NULL, [codelangue] [char](2) NULL ) ON [PRIMARY] with the index CREATE NONCLUSTERED INDEX [table1_id1] ON [dbo].[table1] ( [codelangue] ASC, [classe] ASC, [code] ASC ) INCLUDE ( [description]) WITH (PAD_...

Convert query/stored procedure result set to XML

I'm looking to take the result of a SQL Server stored procedure and transform it into XML in .NET/C# What I'm interested in is what standard libraries there are in .NET to help with the specifics of generating XML and if there any external libraries or tricks that can help automating the transformation from result set to XML. I've look...

Breakdown of time spans between a list of Datetime's

Hello, I have a SQL Server 2005 database table, which has a datetime column. I write an entry in this table every time a service processes an incoming request. What I would like to get is a breakdown of the time spans between sequential entries. If the data is: 2009-10-30 04:06:57.117 2009-10-30 03:52:44.383 2009-10-30 03:42:00.990 2...

Equivalent to VB AndAlso in SQL?

Is there an equivalent to VB's AndAlso/OrElse and C#'s &&/|| in SQL (SQL Server 2005). I am running a select query similar to the following: SELECT a,b,c,d FROM table1 WHERE (@a IS NULL OR a = @a) AND (@b IS NULL OR b = @b) AND (@c IS NULL OR c = @c) AND (@d IS NULL OR d = @d) For example, if the "@a" parameter passed in as NULL ther...

Does the SQL Server 2005 database size property include the full-text index?

The title pretty much says it all, but in SQL Server 2005 Management Studio, if I look at the database properties and pick up the size value, will that include the full-text index data? Does it include the log file as well? Rough values are fine, but some of our ft indexes can be large, so I want to be sure of this. ...

TSQL Conditionally Select Specific Value

This is a follow-up to #1644748 where I successfully answered my own question, but Quassnoi helped me to realize that it was the wrong question. He gave me a solution that worked for my sample data, but I couldn't plug it back into the parent stored procedure because I fail at SQL 2005 syntax. So here is an attempt to paint the broader...

Storing a 30KB BLOB in SQL Server 2005

My data is 30KB on disk (Serialized object) was size should the binary field in t-sql be? Is the brackets bit bytes ? ... so is binary(30000) .... 30KB? Thanks ...

How can i add mdf database to Ms sql server database

I have given asp.net membership provider security into my web application for login and created database into the ms sql server all working fine on local server but, when I transfer my database local machine to server login credential is not working. I am guessing its happen because, I have used asp.net membership security and it has cre...

Executing an Oracle Stored Procedure from SQL Server 2005

how do we execute an Oracle Stored Procedure from SQL Server 2005? As part of a SQL Server scripts we need to execute an Oracle 10g Stored Procedure and download data to SQL Server 2005 ...

SQL Server 2005 Outer Join Problem In Stored Procedure

Good Afternoon All, I have two tables in my SQL Server 2005 DB, Main and MSDRGWEIGHTS. I want to create a stored procedure that updates Main.RelWeight with the appropriate value from MSDRGWEIGHTS. I have written the following code as part of the stored procedure: UPDATE MAIN left outer join MSDRGWEIGHTS AS W ON MAIN.MSDRG=W.MSDRG SE...

Insert value to another sqlserver db

I have 2 SQL Servers: temp1 XX.13.23.2 temp2 XX.23.45.6 The temp1 server has a database called db1 and contains a procedure called p1. I want that procedure to insert the value on Temp2 server Database name db2 on table T1. Is it possible to use procedure to insert value on another server's database? If this is this possible th...

executed an oracle stored procedure from sql server using the open query function

Can you confirm if you have successfully executed an oracle stored procedure from sql server using the open query function. If yes, How? because I am having problems executing stored procedures with arguments using the OPENQUERY Function. ...

SQL Query - Ensure data in a table covers a year, with no date overlaps

I have a table called tblRentalRates with the following columns: rate_id (int) rate_startdate (datetime) rate_enddate (datetime) weekday_rate (money) weekend_rate (money) I want to accomplish the following goal: Write a query that will check the contents of the table and ensure that for the current year, that the data covers ...

SQL Server 2005 UniqueIdentifier and C# Data Type.

Hi What is the best data type to choose in C# for representing a SQL Serer UniqueIdentifier type? I'm was going to use a GUID but I've seen people using varChars. Thanks ...

Query through linked server is very slow

I have 2 SQL 2005 servers SRV1 and SRV2. SRV2 is the linked server on SRV1. I run a storep proc with params on SRV2 and it is completed immediately. But when I run the same proc through the linked server on SRV1, for example EXEC [SRV1].DB_TEST.dbo.p_sample_proc it takes about 8-10 minutes to complete. After restarting SRV2 the problem ...

Error in when comparing British format date in where clause.

When I run this in sql server2005 I got error. select * from productratedates where RateDate BETWEEN '31/10/2009' AND '03/11/2009' Error: The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value. But When I run this in SQl server 2005. It is perfectly all right. select * from productrate...

Sql query to Group by day

I want to list all sales, and group the sum by day. Sales (saleID INT, amount INT, created DATETIME) Update I am using SQL Server 2005 ...

Query to get sum of an employees commission

Query to get total commissions for an employee, and update their totalCommission column in the employee table. This query is run every few days (batch). The rules: 1. an employee can only get a maximum of $100/day of commision, if they get more than $100 it just gets set to $100. Tables: Employee (employeeID INT PK, totalCommissi...