Skip to content

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…

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 t…

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 …

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 …