Below is an example of the T-SQL code you can use to change the password of the sa login account in SQL Server.
The sa account’s password can be changed with the ALTER LOGIN
statement.
Below is an example of the T-SQL code you can use to change the password of the sa login account in SQL Server.
The sa account’s password can be changed with the ALTER LOGIN
statement.
A common security precaution you should consider when administering SQL Server is to rename the sa login.
In addition to renaming this account, you should also disable it altogether and then create other admin accounts to be used instead of sa.
The sa account is widely known as “THE” admin account and therefore it’s a perfect target for hackers. Disabling this login prevents hackers from being able to use it to hack your system, and renaming the account can provide an extra layer of protection.
The sa login is the most famous login account in SQL Server. Every SQL Server administrator knows about it (if they don’t, they should).
Due to its administrative nature, any compromise of the sa account could have catastrophic consequences, including the complete loss of control over SQL Server.
It is therefore widely considered good security practice to disable the sa account altogether. And as an extra precaution, rename the account and change its password. Other admin accounts can be created as required.
The ISNUMERIC()
function in SQL Server enables you to check whether or not an expression is numeric.
However, there may be times where you get results that you didn’t expect. This could happen if you have an expression that contains a character that is not a number, but is still accepted by ISNUMERIC()
as being numeric.
There are a bunch of characters that ISNUMERIC()
accepts as numeric that you might not have thought of as numeric. These include characters such as plus (+
), minus (-
), and the various currency symbols. Also, depending on its placement, the letter e
could also allow the whole expression to be interpreted as numeric.
In SQL Server, you can use the ISNUMERIC()
function to find out whether an expression is numeric or not.
The function returns 1 if the expression is numeric, and 0 if it’s not.
To use this function, simply pass the value/expression to the function while calling it.
In SQL Server 2019, you can use the sys.xp_delete_files
stored procedure to delete a file on the file system.
This stored procedure was introduced in SQL Server 2019, and it can be used in conjunction with sys.xp_copy_file
and sys.xp_copy_files
(both of which were also introduced in SQL Server 2019), which enable you to copy files.
Prior to SQL Server 2019, you would need to use xp_cmdshell
, which spawns a Windows command shell and passes in a string for execution. The new stored procedures introduced in SQL Server 2019 allow you to copy and delete files without relying on xp_cmdshell
.
Two new stored procedures introduced in SQL Server 2019 are sys.xp_copy_file
and sys.xp_copy_files
, which enable you to copy files.
Prior to SQL Server 2019, you would need to use xp_cmdshell
, which spawns a Windows command shell and passes in a string for execution. The new stored procedures introduced in SQL Server 2019 allow you to copy files without relying on xp_cmdshell
.
In SQL Server, you can use the FILEPROPERTY()
function to return the property value for a specified database file. The returned value is either 1 or 0 (or NULL if the input is invalid).
To use it, provide the file’s logical file name and the property value that you want returned.
In SQL Server, you can use the FILEGROUPPROPERTY()
function to return the filegroup property value for a specified name and filegroup value. The returned value is either 1 or 0 (or NULL if the input is invalid).
To use it, provide the filegroup name and the property value that you want returned.
In SQL Server, you can use the FILEGROUP_ID()
function to return the ID of a filegroup, based on its name.
To return the filegroup ID, simply pass its name to the function.