sql-server-2005

Web Site Administration Tool: Unable to connect to SQL Server database (using SQL Server Development Edition)

Hello: I am using the ASP.NET 2.0 and I am using local server --> SQL Server 2005 Development Edition. WHen I go into VIsual Studio 2.0 Professional and go to menu item WEBSITE --> ASP.NET CONFIGURATION, the ASP.NET Web Site Administration Tool shows. When I click on the Security link, after about 30 seconds an error pops saying Unable...

Find out the values between a range in SQL Server 2005(SET BASED APPROACH)?

I have a table like Id Value 1 Start 2 Normal 3 End 4 Normal 5 Start 6 Normal 7 Normal 8 End 9 Normal I have to bring the output like id Value 1 Start 2 Normal 3 End 5 Start 6 Normal 7 Normal 8 End i.e. the records between Start & End. Records with id's 4 & 9 are outside the Start & End henceforth...

Calculate statistical mode in SQL Server 2005

I have these 2 tables: Course(PK CourseId, Title) and Attendee(PK AttendeeId, FK CourseId, Method). Many attendees can take a given course via any of 6 methods. How can I print out one record for each course in the Course table (CourseId, Title) with the statistical mode of the Method for all the attendees to each course? ...

Error: Cannot got to specified record. Access 2007 and SQL 2005

I have inherited an Access 2007 database that has been split so the tables are on a SQL 2005 server. The database consists of 3 tables and 3 forms. The main form that is used reads and writes to all 3 tables. Data can be edited and deleted OK but trying to add a new record throws an error saying, "You can't go to the specified record"...

Add identity column to an non-identity integer column in SQL Server 2005

Hi, I know how to do this and moreover this has been asked by many peoples in STACK OVER as well as bunch & bunch of stuffs are available in the net. However, while googling, I came across something interesting (at least for me) adding IDENTITY to existing column The solution to the above question (obtained from that site, at the bot...

Sql 2005 CLR Integration - Is Dynamic Assembly Loading supported??

I have a static class which loads a .NET assembly dynamically (using Assembly.LoadFile method) I get the following error message: Msg 6522, Level 16, State 2, Line 3 A .NET Framework error occurred during execution of user-defined routine or aggregate "MySQLCLRUDFFunction": System.TypeInitializationException: The type initializer for '...

Microsoft SQL 2005 active cluster node has 100% CPU load after clustering

Before moving to the SQL Server 2005 cluster we had on avarage 60% CPU load. After moving to active/passive cluster (with the exactly same hardware), the load on active node CPU is becoming 100% and after a while time-outs are comming from our web application. Any ideas what could be a couse? Additional info: OS: Windows Server 2008 Ent...

SQL Query Performance '<>' operator vs NOT EXISTS

I am working on optimizing one of the SQL Job. Here I have few places where we have used <> operator. THe same query can be replaced using NOT EXISTS operator. I am just wondering which is better way of doing it. Sample Query If(@Email <> (select Email from Members WHERE MemberId = @MemberId)) --Do Something. --Same thing can be wr...

Overriten script in SQL Server

I overwrote my Stored Procedure with a old script by mistake. I dont want to re code everything again. Is there any way I can get the old Stored Procedure script? ...

Where is the log file located when verbose history logging is turned on for SQL 2005 replication?

Hello, I keep getting the The merge process was unable to create a new generation at the 'Subscriber'. Troubleshoot by restarting the synchronization with verbose history logging and specify an output file to which to write. (Source: MSSQL_REPL, Error number: MSSQL_REPL-2147200994) Get help: http://help/MSSQL%5FREPL-2147200994 message. ...

Function call in where clause

I have a query as below: SELECT * FROM Members (NOLOCK) WHERE Phone= dbo.FormatPhone(@Phone) Now here I understand that formatting has to be applied on the variable on column. But should I apply it on variable to assign to some other local variable then use it (as below). Set @SomeVar = dbo.FormatPhone(@Phone) SELECT * FROM Me...

How to improve performance of non-scalar aggregations on denormalized tables

Suppose we have a denormalized table with about 80 columns, and grows at the rate of ~10 million rows (about 5GB) per month. We currently have 3 1/2 years of data (~400M rows, ~200GB). We create a clustered index to best suit retrieving data from the table on the following columns that serve as our primary key... [FileDate] ASC, ...

Query Performance help

I have a long running job. The records to be processed are in a table with aroun 100K records. Now during whole job whenever this table is queried it queries against those 100K records. After processing status of every record is updated against same table. I want to know, if it would be better if I add another table where I can update...

How to add an uniqueidentifier column and insert values

Hi Friends, Can any body please, give me some ideas here. I have a huge table with 189999 rows. I need to select only the middle values of it. How can I do it. I added unique identifier column. How do I insert the values in it. Please, suggest. i would really appreciate your helps. I have accepted the answers not. I did not know how to ...

Splitting SQL Job IN Chunks

I have a job with around 100K records to process. I have got many suggestions to split this job in chunks and then process it. What are the benefits of process smaller chunks of data compared to 100K records? What is the standard way of doing it? e.g. Picking 10K records in a temp table and process at a time? ...

sql while loop with date counter

I need to do something like this in sql: declare @StartDate varchar(10) declare @EndDate varchar(10) set @StartDate='12/31/2008' set @EndDate='1/11/2009' Declare @date varchar = @StartDate while (@date <= @EndDate) begin -- some statements set @date += 1 -- basically increment by 1 day end How can I do the above correctly in SQL? B...

MDYY SQL Format

Is there a way to format a sql date like this: 3/11/2009 (as opposed to03/11/2009) 20/7/2008 (as opposed to 20/07/2008) Thanks! ...

How can you identify the PK columns in a View.

I used to use 'GetSchemaTable' to read schema information, but it was missing some 'stuff', so I wrote a big query, referencing, among other columns, sys.columns,sys.index_columns, and sys.indexes (and other tables) to return the same information I used to get from GetSchemaTable and also return the other pieces of information I want. P...

SQL Server 2005/8 Replication Transaction ID

I have a scenario where I'm using transactional replication to replicate multiple SQL Server 2005 databases (same instance) into a single remote database (different instance on a separate physical machine). I am then performing some processing on the replicated data for reporting purposes. I'm using table level triggers to identify chan...

What T-SQL data type would you typically use for weight and length?

I am designing a table that has several fields that will be used to record weight and lengths. Examples would be: 5 kilograms and 50 grams would be stored as 5.050. 2 metres 25 centimetres would be stored as 2.25. What T-SQL data type would be best suited for these? Some calculation against these fields will be required but using a de...