Other MSSQL commands

 
BACK
ver: 2025-01-30

 There are several ways to change the administrator of the database. One of them is.

sp_changedbowner 'pal'

Database size and determinatin of detailed settings

sp_helpdb [database_name]

Determining the MSSQL version

SELECT @@VERSION

Copying data to a new table

SELECT * INTO [database1].dbo.[table1] FROM [database2].dbo.[table2]

 

Finding the database by the location of the data file

select * from sysdatabases  where upper(filename) like upper('%cast_cesty_databaze%')

Display of collation databases "pal"

SELECT name, collation_name,compatibility_level FROM sys.databases WHERE UPPER(name) LIKE UPPER('%PAL%');

Check collation tof tables and columns

SELECT DB_NAME(), t.name, c.name, c.collation_name, s.name
 FROM sys.tables t
 INNER JOIN sys.columns c ON c.object_id=t.object_id
 INNER JOIN sys.types s ON s.user_type_id=c.user_type_id
WHERE c.collation_name not like '%CS_AS' AND c.collation_name is not NULL
ORDER BY t.name ASC, c.name ASC;

Active SQL Server Connections For Database

SELECT DB_NAME(dbid) AS DBName,
COUNT(dbid) AS NumberOfConnections,
loginame
FROM    sys.sysprocesses
GROUP BY dbid, loginame
ORDER BY DB_NAME(dbid)

 

 

 

https://www.palstat.cz/