How to capture active processes in PROD?
Hi Experts,We have a process which contains few SQL operations including truncate table, view execution and INSER INTO records. It takes 30 minutes and sometimes 2 hours also for same amount of...
View ArticleIdentifying stale data within a time series table
Hello. I am trying to create a query in order to identify stale price data from a table in sqlserver.I have a table with the following columns. 1) effective date2) product ID3) product Name4)...
View Articlehow to get the weekly sales of summing up each week in sql
hi i want to get weekly sales after summing up totalsales of each week. following is my table how to accomplish this...
View Articlenot to get certain rows
Hi,We are using sql server 2012. We have one stored proc with multiple queries in it. One of the query is complicated with lot of join and other conditions, whose data is inserted into tmp table. I got...
View Articlefn{
I am writing code that includes a concatenation. SQL keeps changing concat( into fn{concat(. This limits my arguments to two and I have more tan two arguments. How can I add this to my view and not...
View ArticleWHat is query_store_query_text system view for?
Hi,Can you please let me know what the below system views do?query_store_plan query_store_query query_store_query_text query_store_runtime_stats query_store_runtime_stats_intervalCurrently I am seeing...
View ArticleDatediff off by one day?
Why would Datediff return 6 and not 7 ? DECLARE @dt1 DATETIME DECLARE @dt2 DATETIME SET @dt1 = '05/27/2014' SET @dt2 = '06/02/2014' SELECT DATEDIFF(DAY,@dt1,@dt2) AS DateDiffValThis...
View ArticleSQl Query Help.
dear friends, in my table data is like below. id date roleno 1 01-jan-2014 3 1 02-feb-2014 3 1 03-april_2014 3 2...
View ArticleConvert The Difference Between StartDate and EndDate Into Hours, Minutes And...
Hello!Using T-SQL, I want to convert the difference between two dates into hours, minutes and second like so: hh:mm:ssI anticipate your help. Thank you.Zionlite
View ArticleSelect Where In Operator with Insert Into SQL 2005 SP2
I'm trying to do the following:INSERT INTO [dbo].[table] ([Column 1) ,[Column 2] ,[Column 3] ,etc...)SELECT * FROM...
View Articlevarbainary(max) issue when using SQLSVR32.DLL vs SQLNCLI10.DLL ODBC Drivers
When I setup an ODBC connection with SQLSRV32.DLL (date 2/18/2007) I can open and read a varbinary(max) field that has a JPEG picture with no trouble.If I setup another ODBC connection with...
View ArticleWrite a query to a xl file
Hi everybodyI need to write a simple query result to a xl format file, how can I do that?
View ArticleDateTime Interval in "DD HH:MM:SS"
HelloI have two columns with DATETIME data and I have to retrieve the interval between them in "DD HH:MM:SS"Ex. one is 2014-06-05 10:55:00 and the other is 2014-06-07 11:30:10, I need the output to be...
View ArticleGenerating a double sequence of integers in T-SQL with CTE
Hello,I know how to generate a single sequence of integers with CTE : ;with cte(i) as ( select 1 as i union all select i+1 from cte where i<10 ) select * from cteBut how do I generate a double...
View ArticleDateDiff Issue
What is wrong with the query below? SELECT DATEDIFF(hour,GETDATE(1),GETDATE(-2)) + ':' + DATEDIFF(minute,GETDATE(1),GETDATE(-2)) MOD 60 + ':' + DATEDIFF(second,GETDATE(1),GETDATE(-2))...
View ArticleAlternative for Cursor in SQL Server 2012
Hi all, I keen to know Alternative for Cursor in SQL Server 2012. Why everyone telling Cursor have performance impact. Any other alternative for row by row comparison like Array in SQL 2012 ?Thanks
View ArticleUpdate Nulls With Value from Another Row
Good Morning,I word for a car manufacturer. I am pulling an excel spreadsheet into SQL 2012.The spreadsheet lists one line for each dealer, each carline. So if there are 6 carlines and 65 dealers there...
View ArticleQuery - Seems Simple But I Don't Get It
My table looks like this:SampleID AttributeID Value163 black263 black265 west365 east463 white465 west563 black565 westI want to get the sampleID's whose attributes are 65 and value = 'west',...
View ArticleSelect all records under given fromdate and Todate
I have table called leave transaction Given parameters : EmpID = 431, LeaveFromDate=01-01-2014, LeaveTodate=31-01-2014EmpId LeaveFromDate LeaveTODate...
View ArticleHelp With Null
I have a match-up table and a main table. In the match-up table I need to display all values accounting for null. But Null from my matchup table and null from my main table are not matching up. How...
View Article