Skip to content

Tag: sql-server

Generate class from database table

How can I generate a class from a SQL Server table object? I’m not talking about using some ORM. I just need to create the entities (simple class). Something like: Given some table like: Answer Set @TableName to the name of your table.

Caching SQL queries

If I look in my profiler for SQL-server, it comes up with a lot of duplicate queries such as: A lot of these queries are not needed to display real time data, that is, if someone inserted a new record that was matched in that query it wouldn’t matter if it didn’t display for up to an hour after in…

SQL query for today’s date minus two months

I want to select all the records in a table where their date of entry is older then 2 months. Any idea how I can do that? I haven’t tried anything yet but I am on this point: Answer If you are using SQL Server try this: Based on your update it would be: