Be Stronger Then You Excuses

Happiness is the best medicine.

Be Stronger Then You Excuses

Happiness is the best medicine.

Be Stronger Then You Excuses

Happiness is the best medicine.

Be Stronger Then You Excuses

Happiness is the best medicine.

Be Stronger Then You Excuses

Happiness is the best medicine.

MS-SQL query and ShortcutKey

1:- Change Database Name using Query


Alter database Test modify name=Test1

you can also use system stored procedure

sp_renameDB 'Test1','Test'

2:- How to get all table name from database 

First select database and run below query.

SELECT name FROM sys.tables

3:- How to Get All stored procedures in database.

SELECT   ROUTINE_SCHEMA, ROUTINE_NAME

FROM INFORMATION_SCHEMA.ROUTINES

WHERE ROUTINE_TYPE = 'PROCEDURE';

4:- Check Size of database 

Run  sp_spaceused Stored Procedure

exec sp_spaceused


2:-   ShortCut Key

Command Name Shortcut Keys
Execute F5
Execute Current Statement F8
SQL Query History CTRL+ALT+H
Edit Parameters CTRL+SHIFT+P
Hide/Show additional document views CTRL+R
Comment Selection CTRL+K, C
UnComment Selection CTRL+K, U
Go To Definition F12

Transact-SQL Functions

 


Transact-SQL (T-SQL) functions are subprograms that encapsulate a sequence of T-SQL statements. T-SQL functions can return a single scalar value, a single row, or multiple rows.

There are two types of T-SQL functions:

·        Scalar functions: return a single scalar value, such as an integer, a string, or a date/time value.

·        Table-valued functions: return a table, allowing multiple rows to be returned and processed like a physical table.

Some common T-SQL functions include:

·        Aggregate functions: COUNT, SUM, AVG, MIN, MAX, etc.

·        Date and time functions: GETDATE, DATEADD, DATEDIFF, etc.

·        String functions: LEN, SUBSTRING, CHARINDEX, etc.

·        Conversion functions: CAST, CONVERT, etc.

System functions: @@ROWCOUNT, @@IDENTITY, @@ERROR, etc.

Functions can be used in T-SQL statements to manipulate data and simplify complex calculations.