using sql server: I have a number of commands that trim a txt file, example: Case when charindex(‘-‘, Substring([RawStreamOut], 179, 10)) > 0 then ‘-‘ + Replace(LTrim(RTRIM(…
Tag: sql-server
Split string without string_split (Sever 2012) [closed]
I would like to know if and if it’s possible how to split a string in to different columns. So first of all I have the table tabOld which contains: name 5522-rep__-4210-03-test-434907-emn-nt.pdf …
Group by Count of DateTime Per Hour by removing Duplicates?
I have a table named loginData: userName timestamp abc ‘2007-01-01 12:00:12 AM’ def ‘2021-01-01 12:09:12 AM’ abc ‘2021-01-01 12:40:12 AM’ abcde ‘2021-01-01 12:44:12 AM’ From this …
Create calculated field from MIN() and MAX() values of another column, grouped by unique ID
I have a table that looks like this, containing information about an object’s position and the length of time it existed for (age): Date ID Age x y 2021-03-25 20 1 531 295 2021-03-25 20 …
How to copy information in SQL from one table to another
I need to build a query to copy information in a column from one table to a column in another table. This is how the tables looks like: People: PersonId Name StatusId 1 John 2 Jenny 3 Steve …
Sumarize colums to get just one value
I get the result shown below, but I need to get only one row with the sum of the column QTD_PARC and VL_TIT, this in the SQl Server, can someone help me please?
Subtotal of child records without COUNT?
ParentSub Table: ParentCode SubCode CompanyName MEGA1 MEGA1 Megacorp MEGA1 SUBC1 Subsidiary Company MEGA1 EASC1 East Coast Operations MEGA1 EURC1 Europe Company BIGLY ALPH1 Alphabet Company …
SQL inner join on column A and compare values in column B
I am sure or maybe hope there is a simple way to do this. Below is my latest attempt. The query should return only one row, but I get 31. Query: `select distinct a.[EC CERS], a.[EC Tank ID], […
Get suppliers that doesn’t belong to a category in another table
I’m looking for a query where I need to show all the Suppliers from the Suppliers table that doesn’t have products from category 1 (Products.CategoryID = 1). Whenever I run it it always gives an error. Side question: How do I get these results but with suppliers that has products from cat. 6 ? (So…
Sql – Calculate Inventory Days
I’m trying to calculate inventory day’s over time. I have an issue getting the actual amount of day’s in inventory for the last month. So as for the first row, the 9 days is correct. However the second row should show 34. Since I want to calculate the days between Inv_date and “today&#…