I have seen this like:
EXEC master.dbo.xp_cmdshell
What does master
refer to?
Update
And why sometimes is followed by two points:
master..
generally we would use master.dbo.
Am I correct, so why some people write master..
?
The xp_cmdshell is a very powerful extended procedure used to run the command line (cmd). This is very useful to run tasks in the operative system like copying files, create folders, share folders, etc. using T-SQL.
The EXEC command is used to execute a stored procedure.
As we have discussed before , xp_cmdshell is a mechanism to execute arbitrary calls into the system and because of the flexibility of its nature, it is typically abused and leads to serious security problems in the system.
The EXEC command is used to execute a stored procedure, or a SQL string passed to it. You can also use full command EXECUTE which is the same as EXEC.
master
is one of the default SQL Server system databases. You can tell because what you posted:
EXEC master.dbo.xp_cmdshell
...uses the three name notation. "master" is in the database position, "dbo" is the schema, and "xp_cmdshell" is the function/stored procedure in this case. You use this notation for also referring to tables and views, in different contexts.
This:
EXEC master..xp_cmdshell
...just omits the schema, but isn't a good idea if there are more than one schema being used in a database.
It refer to a stored procedure that has been created (by default) in the master table.
The name master refer to the database that contains the different schema of your server instance.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With