Remove SCHEMABINDING from a View in SQL Server

The purpose of schema binding a view is to ensure that the base tables referenced in the view cannot be modified in a way that would affect the view definition.

This is normally a good thing. After all, you don’t want someone coming along and dropping a table that your view depends on, do you?

But what if you need to make changes to one or more tables referenced by your view?

Continue reading

Create a Temporary Table in SQL Server

In SQL Server, temporary tables are created using the same CREATE TABLE syntax as regular tables. The difference is that temporary tables’ names are prefixed with either one or two number signs (#), depending on whether it’s a local temporary table or global temporary table:

  • Local temporary tables are prefixed with a single number sign (#)
  • Global temporary tables are prefixed with a double number sign (##)

Continue reading