[SQL Server] Object Definition

In summary: I can also get column name and types.It turned out to be really cool. I know how to get schema id, table id with objectproperty. I can also get column name and types.In summary, Pepper learned how to get schema id, table id, objectproperty, and column name and types from an executed T-SQL statement.
  • #1
Pepper Mint
91
139
Hello experts,
I would like to learn the implementation of object_definition function in SQL server. I'd like the one with 2 parameters. Could you help me ? Thank you.
 
Last edited:
Technology news on Phys.org
  • #2
What have you learned so far from reading and researching? Do you have specific questions?
 
  • #3
DaveC426913 said:
What have you learned so far from reading and researching? Do you have specific questions?
I would like to know what this does in SQL Server
e.g object_definition(object_id, column_id)
I know it will return me something, e.g a text string and I think this returned value should be stored somewhere else I just have no clue where it is taken from. I think someone here would probably know this better than I do.
 
  • #5
Pepper, it is PF's policy to not spoon-feed answers to member questions. It is actually a rules requirement that you make some effort to find an answer yourself before we can give much more help than provding hints and pointing you at reading material.
 
  • Like
Likes Pepper Mint
  • #6
Pepper, why don't you execute it, i.e., run it? If you don't have SQL server, it is easy to download a free copy.
 
  • Like
Likes Pepper Mint
  • #7
WWGD said:
Pepper, why don't you execute it, i.e., run it? If you don't have SQL server, it is easy to download a free copy.
Thanks WWGD, I just ownloaded SQL Server 2016 Express edition and learn something new about T-SQL. :partytime:
 
  • Like
Likes WWGD
  • #8
Pepper Mint said:
Thanks WWGD, I just ownloaded SQL Server 2016 Express edition and learn something new about T-SQL. :partytime:
No problem, glad you did, why don't you tell us how it turned out?
 
Last edited:
  • #9
WWGD said:
No problem, glad you did, why don't you tell us how it turned out?
It turned out to be really cool. I know how to get schema id, table id with objectproperty.
 
  • Like
Likes WWGD

1. What is an object definition in SQL Server?

An object definition in SQL Server refers to the structure and properties of a database object, such as a table, view, or stored procedure. It includes information about the object's name, data types, relationships, and permissions.

2. How do I view the object definitions in SQL Server?

You can view object definitions in SQL Server by using the sp_helptext stored procedure, or by using the OBJECT_DEFINITION function. You can also use SQL Server Management Studio to view object definitions graphically.

3. Can I modify an object definition in SQL Server?

Yes, you can modify an object definition in SQL Server by using the ALTER statement. However, certain changes, such as altering a table's primary key or data type, may require dropping and re-creating the object.

4. How do I create a new object definition in SQL Server?

You can create a new object definition in SQL Server by using the CREATE statement. The syntax varies depending on the type of object you want to create. For example, to create a new table, you would use CREATE TABLE followed by the table name and column specifications.

5. Are object definitions specific to SQL Server?

No, object definitions are not specific to SQL Server. Other relational database management systems, such as Oracle and MySQL, also use object definitions to define the structure and properties of database objects.

Similar threads

  • Programming and Computer Science
Replies
16
Views
1K
  • Programming and Computer Science
Replies
6
Views
1K
  • Programming and Computer Science
Replies
6
Views
1K
  • Programming and Computer Science
Replies
7
Views
474
  • Programming and Computer Science
2
Replies
51
Views
4K
  • Programming and Computer Science
Replies
28
Views
721
  • Programming and Computer Science
Replies
18
Views
3K
  • Programming and Computer Science
Replies
17
Views
1K
  • Programming and Computer Science
Replies
5
Views
2K
  • STEM Academic Advising
Replies
1
Views
681
Back
Top