uliasz.com

Just another WordPress site

SQL

Automatic generation of EF entities and mappings from existing database schema

This is  a bunch of useful scripts for generating C# Entity Framework Code First POCOs from existing database schema. First, let’s create T-SQL function for generating C# class for EF entity: This function deliberately ignores certain…

Simplest way to restore MSSQL Server database

Here’s a simplest way I found (so far) to restore a database in MS SQL Server. First part lists “logicalnames” from the backup that you want to restore. Modify the path so it points to…

How to delete all stored procedures from MSSQL database using cursor

Here is a code for deleting all stored procedures in SQL Server database using cursor. DECLARE @name varchar(500) DECLARE @sql varchar(max) SET @sql = ” DECLARE cur CURSOR FOR SELECT [name] FROM sys.procedures OPEN cur…

SQL Data Types vs. C# Data Types

This article is just a reference of SQL Data Types to C# Data Types. SQL Server data type CLR data type (SQL Server) CLR data type (.NET Framework) varbinary SqlBytes, SqlBinary Byte[] binary SqlBytes, SqlBinary…

Clustered vs. Non-clustered indexes in SQL Server

In this article I will make attempt to outline differences between clustered and non-clustered indexes in SQL Server. Be fully aware that it is not going to be comprehensive explanation, but rather brief overview highlighting purpose…

How to refer to previous row in SQL 2005

In this post I will describe simple mechanism allowing to refer back to previous row in SQL Server 2005/2008 database table.   For the purpose of this article let’s create a table dbo.AgentLog:   create table dbo.AgentLog…

How to drop all schema objects in MS SQL 2005

I needed to test my SQL implementation script that was a part of big SQL Server Data Warehouse release. For anybody who have ever done large SQL implementation fundamental question is always “Have I scripted everything that is needed?”.…

Categories

Tags

.NET Ajax ASP.NET ASP.NET MVC C# CTE Entity Framework git JavaScript jQuery SQL SQL Server T-SQL Unit Testing WCF Web Services XAML XML