How do I Join Calendar table with other tables with sparse dates
Hi,I 'd need an insight on how to join Calendar table (contains all 2013-14 dates, granularity - day) with 3 other tables with sparse dates but with same granularity - day.Other 3 tables has similar...
View ArticleConvert the oracle sql into sqlserver
Hi All,Please convert the below oracle query into sql server.Thanks in advnace.SELECT * FROM table1 T1, Table2 T2 , Table3 T3 , Table3 T4 , Table4 Tc ,...
View ArticleSYS_CHANGES_COLUMNS - find updated columns
In changetracking table, there is binary columns with name: SYS_CHANGES_COLUMNS. It's value is for example:0x0000000017000000180000004900000001000000It includes the columns which were changed at update...
View ArticlePrioritize values for same column query
Hi all:SQL08-I am having a hard time wrapping my head around how to solve this issue. I have some temp tables that are created in a proc from a series of queries that match up a customer to an order...
View ArticleA statement that uses local temp tables is running slow - tempdb database the...
Running a statement that uses a local #temp table seems to run a lot slower when user activity picks up. I have an equivalent statement that was rewritten to use a CTE that runs much faster. How can...
View ArticleMaking changes to a lot of instances
Hi guys,I need to make a configuration change to my environment, using sp_configure, but I don't want to have to go one by one to make the change. What's usually the best practice when making the same...
View ArticleSum of a column with NULL values
I need a query which will return null while doing sum(fieldA) in sql server 2000 if this fieldA contains NULL values. Please help. URGENT!!!
View ArticleDelete query slow
Below is a delete query that takes 20 minutes to delete 100000 records at a time on a very fast server (quad-processor with 32GB RAM). I have very similar queries that take less than 3 minutes with...
View Articleinserting a non identity incremented value in to a coulmn for multiple records
Hi EveryoneI need a bit of help. I have a table with lots of fields and over 600 records within it. It has one field within it called ExamNumber. This Number is NOT used as an identity number (the...
View ArticleError "Conversion failed when converting date and/or time from character...
I have a table-valued function that run in sql 2005 and when try to execute in sql 2008 r2, return the next "Conversion failed when converting date and/or time from character string".USE [Runtime] GO...
View ArticleHow to improve the performance of a SQL query that runs very slow in SSRS...
I wrote a query that has 5 CTEs for my SSRS Report. In SSMS, it takes only 33 seconds, but it takes 5 minutes to render in the report. I tried to use Stored Procedure, indexes in the table, but did...
View ArticleHow to get difference between 2 resultsets?
I have two different queries and the results are different by only 4 records, but there are over 90K records. How can I compare the two to find out which rows are in one but not the other?
View ArticleSql Baffeled
I am sorry for the brevity, but because of where I work, I can only put this up and I am limited. I can't figure out the SQL I have 2 tables: --recordCrossSystem ID RecordID CrossSysID --Record ID...
View ArticleSum Numbers Within String
select COM, co.KEY, ID, DSCD, SECS,EXCNTfrom company cojoinsecurity se on co.KEY=se.KEY where co.KEY=285313 There are strings in DSCD, and some numbers too. I want to sum in the number within the...
View ArticleJoins with OR condition
Do Joins with OR condition perform badly? What is the alternative?Anonymous
View ArticleHow to retreive data from three table based on common fields in sql 2008?
Hi every body,I have three table as follow:CREATETABLE [dbo].[hesab_moin]( [id] [int] IDENTITY(1,1)NOTNULL, [id_moin] [int] NOT NULLprimarykey, [id_kol] [int] NOT NULL, [type_hesab]...
View ArticleCalling web service from a SQL stored procedure
Hi , In one of the requirement, I need to write a stored procedure which calls a web services method to read and return some XML data. Is it possible to do that ?I was looking for something in google...
View ArticleFILTER VALUES THAT ARE NOT PRESENT
Hello!I have asked a similar question months ago (I believe) and I have no doubt the solution is a simple one. Basically, I am trying to compare two columns and only return the values that DO NOT exist...
View ArticleImproving DELETE performance - SQL Server 2012
Hi,in a my stored procedure I need to use the DELETE statement, and I cannot use TRUNCATE TABLE, in order to deleting rows with a specific year. The table source has more tens of millions of rows and...
View ArticleHow to troubleshoot what grew my primary filegroup?
Hi guys,How do you guys usually troubleshoot when your primary data file unexpectedly becomes too large, and consumes the allocated space assigned to it? Is there a way to find out what statement is...
View Article