x

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!

more ▼

asked Mar 31 at 02:17 AM in Default

avatar image

nvalt
0 1

(comments are locked)
10|1200 characters needed characters left

4 answers: sort voted first

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.

more ▼

answered Mar 31 at 08:18 AM

avatar image

ThomasRushton ♦♦
42k 20 50 53

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

capture.jpg (146.4 kB)
Mar 31 at 02:46 PM nvalt
(comments are locked)
10|1200 characters needed characters left

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⪻odVer=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.jpg (57.3 kB)
more ▼

answered Mar 31 at 10:05 AM

avatar image

nvalt
0 1

You need to change the name of the database. Under the "Attach As" bit in that dialog box. Change that.

Mar 31 at 02:00 PM ThomasRushton ♦♦
(comments are locked)
10|1200 characters needed characters left

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.

more ▼

answered Mar 31 at 03:05 PM

avatar image

nvalt
0 1

(comments are locked)
10|1200 characters needed characters left

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.

more ▼

answered Mar 31 at 07:44 PM

avatar image

nvalt
0 1

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x74
x63
x14
x7
x2

asked: Mar 31 at 02:17 AM

Seen: 42 times

Last Updated: Mar 31 at 07:44 PM

Copyright 2017 Redgate Software. Privacy Policy