Sum of amount per field O.S.s
Good afternoon,I have a SQL code where I can score with 1,2 and 3 the amount of time between the O.S.s , but would like to add the amount of O.S.s in their respective fields . Quantity fields 1hour ,...
View ArticlePage Compression and the 4038 Length Limitation
A good article around Page compression.[url]https://blogs.msdn.microsoft.com/robinlester/2016/06/07/page-compression-and-the-4038-length-limitation/[/url]
View Articlesp_executesql : Trying to make sense of OUTPUT param
Good day,I am having difficulty understanding how to make available a parameter set with dynamic T-SQL.I expect value of the [font="Courier New"]@s_MaxOrderOut[/font] to be already defined in the...
View ArticleWildCard vs all Columns listing - Performance difference
1. If you need all the rows in a table, which provides a lower execution cost?Selecting * from a particular table that is well indexed (SELECT * FROM tbEmployees) ORSpecifically selecting each column...
View ArticleCDC error
Any idea what this error means and what can I do to fix my CDC? I recently implemented CDC on 2014 server and I'm getting this error.An insufficient number of arguments were supplied for the procedure...
View ArticleDate field case statement
Hello,I'm trying to write a case statement for a datetime field to use the logdate as the datestamp when the time in logdate is equal to '00:00:00.000'Datestamp= case when LogDate like '% 00:00:00.000'...
View ArticleXML Parsing
I'm stuck on what I think should be an easy solution. I am trying to read the project.params file that SSIS creates and am having difficulty. I can read the variable name, but how do I get the value?...
View ArticleExclude weekend hours from datediff() function
Hello,I want to get a total amount of hours for a date range, but I want to exclude any weekend hours from this? So, I want to do it all on one select statement as shown below. I'm stuck on the part of...
View ArticleRunning Totals,
Hi,I have a table where we hold the balance on a weekly basis.I want to be able to show the balance on a daily basis based on the transaction values.I've tried a number of techniques, windowing...
View ArticleRemove first 2 digit and change phonenumber format SQL
hi,I have a tableA in which PhoneNumber column have values like 911234567891.i want to remove the first two digits from the start i.e 1234567891 and then i want to change it to phone number format...
View ArticleImport ODBC (DBIntegrator) data into SQL Server 2014 Database
I am trying to copy data from a DBIntegrator ODBC source into SQL Server using the Import Wizard.When I select a table on the Source list and click on <Edit Mappings...> , I get an error message...
View ArticleUpdate a column in one table based on a not null value in a joined table
I am doing a left join and I'd like to update a Boolean column in the left table based on whether a value in the right table is null or not. I can do this with an update with join but I cannot figure...
View ArticleCalculate Working days based on Holidaymaster table
Create Stored procedure with input year and month which should calculate working days of dayshift,NightShift,NightShiftIH based on if its a holiday in Holidaymaster table it should mark in Holiday in...
View ArticleCTE Replacement for Bi-Directional Recursion
Let me start at the beginning. I need to produce a result set that allows for bi-directional recursion, in other words the result set in total is based upon a recursive query and a column in the result...
View ArticleHierarchical data
Hi,I have members that belongs to different group and other member can be in more than one group but in Hierarchy.I.E Group One, these members are only found in this groupGroup Two, Some, not all, of...
View ArticleOR in the where clause or two select statements and a union
Howdy:I'm working a on script that contains an OR statement in the where clause. Below is the contents of the clause.[code="sql"]where ( enc.ADT_PAT_CLASS_C = '103' and enc.adt_arrival_time between...
View ArticleDynamic SQL
Hi :-)I am trying to build a procedure that given a table name will do a select from that table. not only that i am having issues also that i read i need to be careful with SQL Injection and I also...
View Articleincorrect syntax
I am new to SQL & I wonder if anybody can help me with this issue.I am trying to run the following query but it keeps on failing with the Msg 102, Level 15, State 1, Line 12Incorrect syntax near...
View ArticleError converting varchar to type float
I am not sure what is wrong with this query. I am trying to get it working but somehow I am not able to figure out why this query is failing. Could someone please guide me in the right direction. I've...
View Articlehelp with the query
Hi All, I have an employee table,log table and material table with the following structure. From User Id and To user Id from Log table exists in employee table as userID[code]Log TableId From User Id...
View Article