need help with logic, solution is nearly there, but one more hump
I don't know how to solve for Rule 5.An example of correctness is: 1Z3V1F0359168993, with one tracking_number sharing the same ship_date.
View ArticleRun away logical reads on stored proc causing timeouts.
Hi,I am hoping some one maybe have any insight or suggestions.I have a stored proc that returns 10 to 200 rows max it, it is reading by the primary clustered identity key.95% of the time this runs like...
View ArticleAdd two columns when one is the output of a Case statement
I need to add the T.Duty Rate to the Chap_99_Rate. Please advise.[code language="sql"]SELECT l.HTS_99_Num, L.Ctry_Origin, T.DutyRate,
View ArticleDivide by 0 issue
I am trying to divide in SQL:[code language="sql"]Total_Duty / ([Chap 99 Rate] + DutyRate) as Entererd_Value[/code]I think is have to cast as numeric, but nothing i've tries is working.<
View ArticlePivot from row-level without loosing the ColNames
Hi,i need to transform this data from row-level to columnar data.Pivot with ColName and ColValueRegardsNicole
View ArticleInteresting Use Case Of CEILING
I have ran into this while writing a reporting stored procedure. I have found that CEILING will increase to the next higher integer even if the value is even.Here is the example:[code language=
View ArticleQuery conversion error from phantom data
Running 2014 SP1-GDR (KB4019091) in compatibility_level 100, I am getting repeated conversion errors from data that just isn't there.Our data vendor sends data for 14 distinct tables in a single...
View Articleneed 3rd day of Calendar month - date precision to exclude minutes
I need query (in my case an INSERT) to run only if today's date is 3rd day of Calendar Month?how to get date precisions for to exclude minutes on right side of the IF?[code language="sql"] IF...
View ArticleHash or range-index in memory optimized table?
I have memory-optimized tables in SQL Server 2014 to handle a graph problem. The tables can be queried concurrently for multiple sessions, for as many as 50 concurrent sessions. A Node table contain...
View ArticleSSIS connection manager crash course -
Hey there ---I have little SSIS experience but have used similar ETL tools so can work my around.Previous (disgruntled frankly) employee left. His SSIS scripts all broke the next day.I can figure edit...
View Articlefetch multiple rows with single string
Hello friends,I am having table which contains data stdentname,teachername,subjectname as below.Studentname Teachename &nbs
View ArticleGoing from datetimeoffset to datetime
Hi All,I'm hoping to get guidance on this. I'm working on modifying a query used to pull data in an SSIS package. It consists of 3 unions, of which all the former subqueries work fine, however the last...
View ArticleChanging Datatype from Int to TinyInt - How much space can be recovered?
Hi Experts,I am having two tables. 1 is Master having merely 28 records and 2nd, Transaction table, is having around 56 millions of records. Transaction table is being referenced by Master table. Maser...
View ArticleError handling - How to get job name
Hi All,I am currently implementing error handling in all the procedures in my project .Whenever an error occurs i have to make an entry in the error table with the following details.1) Job_name2)...
View ArticleSuggestions on How to Improve Delete
Hi Guys, Any suggestions on how to improve this Delete? delete was causing tempdb log to grow, also would UPDATE be faster than Delete , there are around 31 million records to delete...thanksDECLARE...
View ArticleSQL Optimization
Good afternoon all,trying to optimize a portion of my sql. I've simplified it below, but the portion that it's hang up on is the inner join to the SSICategory, specifically the 2nd part ((n.SSICatyear...
View ArticleQuery Performance
Hello All,Wish you a very happy new year 2019!!I had been asked to review performance of a procedure and I am producing a part of it. There are two similar queries in this procedure and both when...
View ArticleInsert Faster way
Guys,I need to improve this Insert in a faster wayQuery : set identity_insert [Test].dbo.JOB ONINSERT INTO [Test].[dbo].JOB ( [JOB_ID] ,[JOB_DEFINITION_ID] ,[PROCESS_ID]
View Article