SQL

Schemas and SQL Server 2005

Posted by brass on February 16, 2012 at 12:05 pm

Here it is 2012 already and I am just starting to play with schemas in SQL 2005. Anyway, follow the directions below to just start using a Schema as a container or namespace for your objects. Create a Role “schema_owner” and set the owner to dbo. Create schema “myschema” and set the owner to “schema_owner”.  [...]

SCOPE_IDENTITY() returns a value?

Posted by brass on September 19, 2008 at 12:58 am

I have long used SCOPE_IDENTITY() to get the primary key of a newly inserted row immediately after the INSERT statement. For example: INSERT INTO myTableSELET @var = SCOPE_IDENTITY() What I incorrectly assumed was that the value was reset with each statement similar to the behavior of @@ERROR. If not each statement, then each INSERT statement. [...]