While working on a data migration project that uses C# and Azure Functions. I found myself in the need to generate a model of the table(s). While doing a Google search I came across the following blog post that has a script to generate the model properties for me. Simply replace the table name variable at the top of the script with the table name you want to generate the properties for. You may also need to include the schema name in the table name if you have multiple tables with the same name, just under different schema's. I did make one change to it in the select @ result line. It was adding a blank line in between each property, so I removed the new line. declare @TableName sysname = 'TABLE_NAME' declare @Result varchar(max) = 'public class ' + @TableName + ' {' select @Result = @Result + ' public ' + (CASE WHEN ColumnName = 'RowVersion' THEN 'byte[]' ELSE ColumnType END) + NullableSign + ' ' + Co...
This is my blog about my experiences working as a software developer, consultant and systems integrator. I primarily focus on Microsoft Dynamics 365, Microsoft Azure, and Scribe Online.