Skip to content
Advertisement

Tag: sql-server

Capturing difference between 2 tables in one table

I understand my mistake with creating questions in StackOverflow, so I want to rewrite my question. I have two tables. One of them is my target table with old data and the source table with new data. Implicitly I want to compare these 2 tables and get information on which columns have been changed and changed status. So I created

Find numeric record number in string

I’ve been using this site for longer than I can remember, but I’ve never had to ask a question before – I’ve always been able to find what I need – but this one could use some SQL expertise for the best approach since it’s kind of a worst case. I have a text comment field that gets a lot

Parse utm parameters in sql query

I have a table in my database that tracks visitors page views and I am trying to pull out the utm tracking parameters from the url You can use this script to create table This my script I am getting funny results where if there is no utm tracking it is still populating fields and the utm_id is incorrect in

SQL: date type column with only mm-dd

I want to create a column of data type having only ‘mm-dd’ values. Is it possible and if yes how should I do it? Note: Instead of “2022-06-07”, I want “07-06” Answer There is no date type that can store that format – in fact none of the date types store a date and/or time in any of the formats

cast numbers and decimals into INT

I have [funds] that have been presented in different formats, some are decimals, others numbers: etc I tried to use this: ,CAST (REPLACE ([funds],’.’,”) AS INT) AS [funds] but got this mistake: The conversion of the varchar value ‘288294130100’ overflowed an int column. How do I ned to treat the combo of numbers and decimals? Answer You can cast them

Re-aligning dataset so that different period appear on the same row

I have each entity data over three different [periods]. These are: 2022-03-31, 2021-09-30 and 2021-03-31 I want to alter the dataset and have This can as such easily done by case statements. The problem is, I want that data to be aligned, so that [entity] appears and then on the same line [curr_period], [prev_period], [prev2_period] How can this be achieved?

Advertisement