question

nvalt avatar image
nvalt asked

System Metadata Functions Definition

Is there a DMV, DMF, or a procedure that will show me metadata function definitions? The function in interest is OBJECTPROPERTY(object_id, property). I have tried looking and reading a lot of material but have no luck. I tried something like this: SELECT * FROM sys.all_sql_modules WHERE definition LIKE ('create%function%OBJECTPROPERTY%') but no luck either. Is it even possible to see the definitions of SQL Server's internal metadata functions using the system catalog? This has been puzzling me for weeks now! Thanks!
functionssql-server-2014meta-datadefinitionsystem-functions
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

ThomasRushton avatar image
ThomasRushton answered
You might get some information from the SQL Server Resource database; unfortunately, I haven't got a machine to play with at the moment, so I can't check this myself... :-/ The gist of it is: * Find the mssqlsystemresource files - these are in the same directory as your SQL Server executable. * Copy them to a separate location * Create a new database by attaching these files - you *will* need to change the database name as you do this. Have a rummage around in there. You might get lucky.
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

nvalt avatar image nvalt commented ·
I changed the "Attach As" field to a different name, but it still threw the same error. I thought maybe it was a permissions issue for that specific file but that's not the case either. Got any other ideas? ![alt text][1] [1]: /storage/temp/4024-capture.jpg
0 Likes 0 ·
capture.jpg (142.9 KiB)
nvalt avatar image
nvalt answered
I literally tried everything, and it's not letting me attach the database. I tried attaching it just the regular way. I tried doing it as a backup but I keep getting errors. Moving it to different locations and re-naming the .mdf file doesn't seem to do much. Is it possible that there is some proprietary code that SQL Server recognizes and refuses to attach the database. I wonder if trying to clear the .mdf file metadata will do anything. Any ideas? I'll paste below the error I keep getting. =================================== Attach database failed for Server 'DESKTOP-SSECJML'. (Microsoft.SqlServer.Smo) ------------------------------ For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=13.0.16106.4+((SSMS_Rel_16_5).170125-2137)&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Attach+database+Server&LinkId=20476 ------------------------------ Program Location: at Microsoft.SqlServer.Management.Smo.Server.AttachDatabase(String name, StringCollection files) at Microsoft.SqlServer.Management.SqlManagerUI.AttachDatabaseData.PrimaryFile.Attach() at Microsoft.SqlServer.Management.SqlManagerUI.AttachDatabase.SendDataToServer() ===================================![alt text][1] [1]: /storage/temp/4022-1.jpg

1.jpg (56.0 KiB)
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

ThomasRushton avatar image ThomasRushton ♦♦ commented ·
You need to change the name of the database. Under the "Attach As" bit in that dialog box. Change that.
0 Likes 0 ·
nvalt avatar image
nvalt answered
This is only a local server on my laptop I screw around in so i restarted my laptop and was able to successfully attach the file but not before having to change permissions. Thanks for all your help I didn't even know about the resource database file prior.
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

nvalt avatar image
nvalt answered
Just kidding I am back. Do you know if metadata functions such as OBJECT_ID(), SCHEMA_NAME(), or OBJECTPROPERTY() are treated like objects in the resource database? I am looking at definition data and doing string searches across the database but have no luck with finding how these metadata functions are defined.
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.