Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 OBJECTPROPERTY ?

Author  Topic 

ann06
Posting Yak Master

171 Posts

Posted - 2008-04-22 : 03:33:14
in msdn site they used schemaid in the below ex although its not mentioned in the porperty table
where schemaid is documented how they knew it can be used here?

SELECT name, object_id, type_desc
FROM sys.objects
WHERE OBJECTPROPERTY(object_id, N'SchemaId') = SCHEMA_ID(N'Production')
ORDER BY type_desc, name;

http://msdn2.microsoft.com/en-us/library/ms176105.aspx

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2008-04-22 : 05:11:58
Seems like they missed it from documentation. You can always give feedback so they can correct their contents.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

ann06
Posting Yak Master

171 Posts

Posted - 2008-04-22 : 09:29:39
i thought so :S
Thanks Mr. Harsh
Go to Top of Page

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2008-04-22 : 14:24:59
It's in BOL, if that helps:

SCHEMA_ID( [ schema_name ] )


Arguments
schema_name
Is the name of the schema. schema_name is a sysname. If schema_name is not specified, SCHEMA_ID will return the ID of the default schema of the caller.

Return Types
int

NULL will be returned if schema_name is not a valid schema.

Remarks
SCHEMA_ID will return IDs of system schemas and user-defined schemas. SCHEMA_ID can be called in a select list, in a WHERE clause, and anywhere an expression is allowed.

Examples
A. Returning the default schema ID of a caller
select schema_id();
GO


B. Returning the schema ID of a named schema
USE AdventureWorks;
GO
SELECT SCHEMA_ID('HumanResources');
GO

Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2008-04-23 : 06:29:52
quote:
Originally posted by Lamprey

It's in BOL, if that helps:

SCHEMA_ID( [ schema_name ] )


Arguments
schema_name
Is the name of the schema. schema_name is a sysname. If schema_name is not specified, SCHEMA_ID will return the ID of the default schema of the caller.

Return Types
int

NULL will be returned if schema_name is not a valid schema.

Remarks
SCHEMA_ID will return IDs of system schemas and user-defined schemas. SCHEMA_ID can be called in a select list, in a WHERE clause, and anywhere an expression is allowed.

Examples
A. Returning the default schema ID of a caller
select schema_id();
GO


B. Returning the schema ID of a named schema
USE AdventureWorks;
GO
SELECT SCHEMA_ID('HumanResources');
GO





I guess, OP is talking about SchemaID attribute of OBJECTPROPERTY() function.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2008-04-23 : 11:52:18
Doh!
Go to Top of Page
   

- Advertisement -