Performance improvement with Data Compression
I have a question:What will be impact on execution plan or query cost (execution plan - Estimated & Actual) if data is compressed (for example, less IO and more CPU Cost involved here)? As I have...
View ArticleNeed Help for the following SQL Query
Hi,I hope all of you are fine.I am looking for a solution generate report in C# Crystal Reports, and for that I am using SQL Server Stored Procedure. Query gives me duplicate result, if this can be...
View ArticleSql dynamic from table
Hi, I must generate a dynamic sql from a repository table Level Table NeedParent id_Link -------------------------------------------- 1 a NULL NULL 2 b...
View ArticleSysnonym for system objects.
Hi there, I would like to know how does SQL Server determine whether precedence between synonyms and system objects.For example, I've created a synonym [SchemaA].[sp_tables] and the base object is a...
View ArticleSelect one record from multiple based on a group by of column values
Column AColumn BOther columnsKS12233M122KC12233M122KC12555M122KB12555M122Requirement is, If I have Same Numeric values in column A (excluding the first two characters) for a value in Column B I need to...
View ArticleHow to tell if a procedure was call from within a SQL agent job or not
Is it possible to determine within a procedure call whether the procedure was called from within a SQL Agent Job or not?John M. Couch
View ArticleDynamic Pivot more than 1 column
Hi I am re-posting this as i have not been able to resolve my question.I want to use a PIVOT script orig devleoped by Naomi.The orig script allows for a pivot on a single column, where i need to pivot...
View ArticleTransaction Isolation Level and Reading Data
Hi,My Select statement is blocked when the table is modified in long running Transaction even after setting Isolation level to READ UNCOMMITTED.Following i running in one query windowIF EXISTS (SELECT...
View ArticleHow to use CASE instead of If
Could someone please help me on how I would use CASE or ? in the example query below? Thank YouSelect col, if col1 = '0' and col2 = '0' then set test = '175' else if col1 = '0' and col2 = '1' then...
View Articlequering xml data
declare @data xml set @data = '<Data ID="34" ORGANIZATION="2301" STATUS="Active" PER_ID="5833" PERSON_NAME="John Smith" />' select T.C.value('ID[1]', 'nvarchar(128)') AS ID,...
View Articlewhat can cause a simple update to one record to take half an hour
I have sqlserver 2005 with two linked servers, one Oracle in the same server room and the other Sqlserver 2005 in New York, I am in VAWhen I execute the following statement it takes 32 minutes to...
View ArticleNeed SQL to find Consecutive Missing number from table.
I looking for Query which can give me Consecutive missing number from following tablewhere ColB is Available Year ColC is Starting Point and Currunt Year is End pointCol1 ColB Col CA 2012...
View ArticleHow to get first 3 letters and year name from a column in SQL
Hi,I have a column which has the month names something like 'JANUARY - 2013' but i want the output to be like 'JAN _ 2013' which is the first 3 letters of the month and year.Can someone help me with...
View ArticleGet duplicate row occurance of different date
Hello,I want to retrieve staff who attend less than 80% for a meeting type assuming we have 10 meetings per list.- The column for Meeting table "Date" means the date that the staff miss the meeting -...
View ArticleUsing Substring and CharIndex
I have a column on a table in a SCOM datawarehouse DB that contains a block of information. i.eThe process Explorer.EXE has initiated the shutdown of computer SERVER1 on behalf of user domain\john...
View Articlesp_executeSQL recompile
Hi,is it possible that if you have inside procedure dynamic sql, for quick example:CREATE PROCEDURE dbo.myProcedure @ln varchar(15) WITH RECOMPILE AS DECLARE @ExecStr nvarchar(4000) SELECT @ExecStr =...
View ArticleA severe error occurred on the current command. The results, if any, should...
Hello,I'm completely stuck on this error. I run the contents of a function(with param values plugged in) and it returns a collection of rows, yet when I select from the function I get the following...
View Articleunion
Hi,Could someone revise my sql code so that it can run faster? Thank you very much.I have a table with id and cat. There may be multiple rows for the same ID with different cat. cat only has two values...
View ArticleADO 2.8 Update Image Field on SQL Server 2008 R2 DB - Run-time error
HelloI'm trying to update an Image Field on a SQL 2008 R2 DB using ADO 2.8 but I got the following message:"Run-time error '-2147217865 (80040e37)': [Microsoft][SQL Server Native Client 10.0][SQL...
View ArticleConvert Excel/Access IF Statement to a Case If Statement
I am completely lost how on how to change an Excel IF Statement into a Case IF Statement. Can anyone help?Here is my Excel If Statement: Bascially if the I want to return Y if the data is true and N...
View Article