Reasons to specify a separate filegroup for large data (TextImage_On Use..)
Can someone please point me to some reasons/explanation of why I would want to do this.Is there performance benefit or is this feature just about data management?Sorry the question has such wide scope,...
View ArticleContains Exception
I am using sql server 2005.The filed r_resume_text datatype is text.when i run the below query i am getting below exception.please help me how can i solve the issue.SELECT * FROM...
View ArticleFinding Slow Running Queries?
Hi,I was asked to find a performance issues regarding our customer SQL Server 2008R2 instance. They noticed when executing applications two functions simultaneously which are running queries in...
View ArticleOrder of Execution of SQL Queries
I am curious about the order of execution of SQL Queries. I did a bit of research on this. I found this: http://stackoverflow.com/questions/4596467/order-of-execution-of-the-query In that link,...
View ArticleFull log disk, cannot cancel query
hello, on production database, I try to do a query that I know will take much time/log, but my estimations where wrong, so the log disk were full, no error displayed on screen or rollback... so I wait...
View ArticleCan you join on an alias?
Hi,Is it possible to join on an alias (month):SELECT pehPErcontrol,case left(substring(pehPErcontrol,5,len(pehPErcontrol)),2) when '01' then 'January' when '02' then 'Feburary' when '03' then 'March'...
View ArticleWhy is "IT DEPENDS..." the Answer so Frequently in Optimization & Performance...
Even when a newbie asks a trivial appearing question: char(20) or varchar(20) the answer is "It depends...".What is the real reason behind the hesitant reply even by experts? Are we guessing what the...
View ArticleHow to find outdated statistics in SQL Server?
My question is: How to find outdated statistics in SQL Server 2005 and above?I have seen many solution based on sysindexes.rowmodctr in many blogs/sites as below. SELECT id AS [Table ID] ,...
View ArticleAre you any good at T-SQL? Win recognition! Become a TechNet Guru for July 2013
TechNet Wiki is looking for and celebrating the best of the best!Is that you? Do you consider yourself an expert, authority, or just pretty good at this technology?Show us your forum solutions and...
View ArticleDealing with text, ntext, image pointer problem from VFP
Hi everybody,I had the similar problem before and even documented it in this blog postDealing with the "The text, ntext, or image pointer value conflicts with the column name specified." error from...
View ArticleA critical problem : Sql Server Agent service is missing!!!
Hilately, i checked my server jobs which is not run in a few days, when i connect to sql server and check the agent, i see my sql server agent service is missing!!!!!i've tried to reinstall this...
View ArticleHOW TO APPLY CASE WHEN IN DATEDIFF?
Dear All,May i know how to write in case when to show the result ?example, if datediff result is more than 13 hour, then the actual result i want is fix in 12 hour only.KINDLY ADVISE, THANK YOUCase...
View ArticleFinding gaps between consecutive shifts where gap is greater than one hour
Problem: California applies a penalty to a company when an employee has a gap between two shifts greater than hour (>60mins) in the same day, for a given pay week. There are other caveats, but for...
View ArticleHOW TO REMOVE NEGATIVE VALUES IN HOUR & MIN ?
Dear All,How i remove the negative result in hour ?is it can use case when ? ,CASE DATEDIFF(HOUR,(CONVERT(VARCHAR(14),stuff(stuff(FIRSTSCAN.EP_SCAN_DATE,9,0,SHIFTDESC.EP_SHIFT_TIMEFR),9,0,' '),112))...
View ArticleWant the all rows expect the first for a partcular column to be zero.
My query generates data similar to below:Accountnum Amount Amount2-------------- ---------- ----------001 100.00 100.00002 200.00...
View Articlefind dups and report
I need to find invoices tied to different order numbers from same site and invdate. Trying to find some data issues. Ordstbl OrdID int Invnbr nvarchar(25), Ordnbr nvarchar(25), SiteID...
View ArticleError using parameters in a dynamic sql query
I'm having an issue using parameters in a dynamic sql stored procedure. I receive "Must declare the scalar variable "@StartIdex"." when I execute the stored procedure. The issue is being caused by...
View ArticleRemove Dups
Hi All,In my below query creating duplicate records.SelectMem.*, 2011.[STATUS]as[2011_STATUS], 2012.[STATUS]as[2012_STATUS], 2013.[STATTUS]as[2013_STATUS] from FINALmemleft outerjoin...
View ArticleNon varchar/nvarchar data types
Hi,I want to run a validation on values present in columns with data types other than varchar/nvarchar (i.e. int/money/bool etc).I want to filter out NULL and empty records.i.e. for a column that is of...
View ArticleUsing CTE to populate records
Hi,I have a table called Periods:Period=============Period 0-1 daysPeriod 1-2 daysPeriod 2-3daysI need to cross join this table to another table (CTE) such that the resultant will be 5 Periods (i.e....
View Article