Skip to content

Tag: split

SQL Find column with multiple possible values

I have two tables: TABLE 1 TABLE 2 I need the rows from Table 1 where i can have ALL values from table 2. The values from table 2 are dynamic, so i need to create a procedure to search for these possible values. My output should be in that example: Answer You can do this by doing a join

Split Row and Paste to Different Tables Based on Column

I have a table like this. Table is populated each time an order is complete. One order can have one or many compartments. Please help write an SQL script that takes the above and splits it into two new tables like so: Table 1 Table 2 I’ve tried using the DISTINCT command as suggested; Which returns the …

Split String and Count Teradata SQL

I would like to split column ‘ASPCT_VLU_NM’ and count of occurrences of the timestamps in a given time frame. For example return the ID which have more than 3 occurrence in between 1537160520286 and 1537190520286. In the example below those are the timestamps : Answer If you are using Teradata 14 …

Extract substring address SQL

I have a table with column Address which is like city. City_Name, citysector. CitySector, Street. Street_Name, StreetNumber. Street_Number EXAMPLE Address c. Paris, s. ParisDowntown, str. Rue Étienne Marcel, nr. 50 How can I substract 4 different columns like city, sector, street, streetNumber from Address co…

Filter msdb.dbo.sysjobsteps.command into seperate columns

I am trying to split the msdb.dbo.sysjobsteps.command column into separate columns to show the following information: folder project dtx package A small sample of my data is below: I have tried to use the substring method, however I cannot seem to get the starting and ending number of the substring. My aim is…