This article explains how to update a table column with random values from another (lookup) table in SQL Server.
For example, Country table has two columns CountryID, CountryName and UserInfo table has CountryID column. We will update UserInfo table with random CountryIDs from Country table.
Continue reading SQL Server: Updating A Column With Random Lookup Values
This article shows how to display real time sql server database change notification in ASP.NET using SignalR and SqlDependency object which represents a query notification dependency between an application and an instance of SQL Server. Consider your database is updated or synchronized by windows service in background, you have to display real time updated data. This article explains how to implement it.
Continue reading Database Change Notifications in ASP.NET using SignalR and SqlDependency
Sometimes we need to convert one data type to another data type to map columns in sql server. You might not be allowed to change table structure directly. In this case you’ve to convert in your query or stored procedure. Suppose you’ve to convert money data-type to decimal for greater precision in calculation then you can do it easily using Cast or Convert methods. Continue reading SQL Query To Check Money Data Type and Convert it to Decimal Dynamically
Generally, We use SQL Where .. IN Statement to determine whether a specified value matches ANY value in a sub-query or a list. But sometimes we require to get data which have ALL specified values, not ANY value. In this post, we’ll see how to accomplish it. Let’s take an example, Consider following data in Orders table Continue reading How To Use SQL IN Statement to Select Data Having All Specified Values
It explains how to implement an audit trail quickly by creating shadow table for each table in database and triggers to log every time when a record is inserted, updated or deleted in the table. Continue reading Implement Audit Trail Quickly for Microsoft SQL Server