Let’s say you have a table called ‘car_make’ and another table called ‘car_model’. There is a one to many relationship between make and model.
You want to bring back a result set of all makes, 1 row per make, but …
Let’s say you have a table called ‘car_make’ and another table called ‘car_model’. There is a one to many relationship between make and model.
You want to bring back a result set of all makes, 1 row per make, but …
update a set a.some_column = b.some_column from some_database.dbo.some_table a JOIN some_database.dbo.some_table b ON a.some_column = b.some_column where a.some_column = 'some_value'…
If your sql server is installed with the default collation of case-insensitive, you can accomplish this in sql instead.
You can determine if your installation collation is case-insensitive by running this query:
SELECT SERVERPROPERTY ('Collation') GO
If the result is …
Let’s say you have a column in a table that is comma delimited. The value in the column is ‘APPLE, ORANGE, GRAPE’. You want to break down this string value into individual rows. You may also want to create an …
[UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))] [FileLoadException: Could not load file or assembly 'System.Web.RegularExpressions, Version=2.0.0.0, Culture=neutral, PublicKeyToken°3f5f7f11d50a3a' or one of its dependencies. Access is denied.] System.Web.Configuration.RegexWorker..cctor() +0
Go to the Reporting Services Configuration Manager and …
— This SQL reads in a varchar(10) field called work_hours that could have anything in it. It should be numeric represented as decimal.
— The CASE statement will produce either 0.00, or (if it is numeric) whatever is in the …
SELECT * INTO dbo.NewTable FROM dbo.OldTable
Create only a subset of columns:
SELECT column5, column8, column11 INTO dbo.NewTable FROM dbo.OldTable…
As mentioned in my last post (Loop through an existing table), I said that I would expound on its example by reading a column that contains a delimited string. In this case, it will be an address that …
In T-SQL you may want to loop through an existing table and do something. You may want want to use this type of processing in a SSRS report.
Here is an example of walking through a table that simply extracts …
Finding rows on a table is straight forward when filtering on columns, but what if you want to find duplicate data.
Let’s say I have a table that represents parents and children. The key to the table is the parent …