How do I do multiple CASE WHEN conditions using SQL Server 2008??

What I'm trying to do is use more than one CASE WHEN condition for the same column. Here is my code for the query: ...

Lock Escalation - What's happening here??

While altering a table (removing a column) in SQL Server 2008, I clicked the Generate Change Script button and I not...

How to update Identity Column in SQL Server??

I have SQL Server database and I want to change the identity column because it started with a big number 10010 and i...

How to write UPDATE SQL with Table alias in SQL Server 2008??

I have a very basic UPDATE SQL - UPDATE HOLD_TABLE Q SET Q.TITLE = 'TEST' WHERE Q.ID = 101; This query runs fine ...

Invalid viewstate error in asp.net page?

The webpage is a simple registration type page. Each user has to fill around 200 fields. There is 1 parent table and...

SQL Server SELECT LAST N Rows?

This is a known question but the best solution I've found is something like: SELECT TOP N * FROM MyTable ORDER BY I...

How to execute a stored procedure inside a select query?

SELECT col1, col2, col3, EXEC GetAIntFromStoredProc(T.col1) AS col4 FROM Tbl AS T WHERE (co...

Dynamically column names from select sql?

I have the following data output from my database Observation 1 aug -2015 Improvement suggestion 1 ...

Insert into with union?

I have a problem. There are three tables: T1, T2, T_target. T1 and T2 table have many different columns but I need o...

Count records for every month in a year?

I have a table with total no of 1000 records in it.It has the following structure: EMP_ID EMP_NAME PHONE_NO ARR_D...

Remote Procedure call failed with sql server 2008 R2?

I am working with SQL Server 2008 R2. I am unable to connect to my database remotely. I got the following error. ...

Disable Transaction Log?

Oracle has SQL commands that one can issue so that a transaction does not get logged. Is there something similar for...

Merge Multiple Databases into a Single Database?

All, I have to create a single database which has a basic schema. This database is going to be large (100GB plus), a...

How can I truncate a datetime in SQL Server??

What's the best way to truncate a datetime value (as to remove hours minutes and seconds) in SQL Server 2008? For e...