Category: Microsoft SQL Server

Microsoft SQL Server

Check for null passwords in Sql Server

One of the many ways to secure SQL Server is to review all passwords. You must also check for null passwords and if you locate any, change them. To list all users with null passwords, execute the following sql command: USE master GO   SELECT name, password FROM syslogins WHERE password IS NULL;use master go …

Microsoft SQL Server

Get Field Name and Type of Database Table

Today we will see how we can retrieve table’s columns’ names and types. USE mydatabase GO   SELECT column_name, data_type FROM information_schema.columns WHERE TABLE_NAME = ‘mytable’;use mydatabase go SELECT column_name, data_type FROM information_schema.columns WHERE table_name = ‘mytable’;

Microsoft SQL Server, Microsoft Windows

How do I fix “Cannot connect to WMI Provider” error?

Error Message: Cannot connect to WMI provider. You do not have permission or the server is unreachable. Note that you can only manage SQL Server 2005 servers with SQL Server Configuration Manager. Invalid Namespace. This error is caused when the .mof files are damaged during the MS SQL Server 2005 installation. This error typically occurs …

Databases, Microsoft SQL Server

Retrieve useful information from SQL Server

Today we will see how can we retrieve various information from Microsoft SQL Server using SQL queries. Get all users: SELECT * FROM sys.server_principals;SELECT * fROM sys.server_principals; Get database size: USE master GO   EXEC sp_spaceuseduse master go exec sp_spaceused Get user privilleges for current database: USE master GO   SELECT SYSOBJECTS.name AS ‘objectname’, SYSUSERS.name …

Microsoft SQL Server, MySQL, Oracle

SQL column name with blank space

Let’s see how we can write queries when a column name contains spaces:   Microsoft Sql Server SELECT [COLUMN Name] FROM TABLE_NAME;SELECT [Column Name] FROM table_name; MySQL SELECT ‘Column Name’ FROM TABLE_NAME;SELECT ‘Column Name’ FROM table_name; Oracle SELECT "Column Name" FROM TABLE_NAME;SELECT "Column Name" FROM table_name;