No Image

SQL Statements – JOIN

August 27, 2017 hung-nb 0

INNER JOIN Return common records from 2 tables LEFT JOIN Return all records from LEFT table Return matching records from RIGHT table CROSS JOIN OUTER […]

No Image

SQL statements – INSERT

August 22, 2017 hung-nb 0

How to INSERT data? How to insert by EXECUTE sql string? Example [sql] DECLARE @strSQL varchar(max) SET @strSQL = ‘SELECT * FROM <one_table>’ INSERT INTO […]

No Image

Questions

August 1, 2017 hung-nb 0

What is the difference between TRUNCATE and DELETE? Which TRUNCATE or DELETE is better? How to record actions happening on Stored Procedures? How to record […]

No Image

SQL: DB/ Table Queries

July 3, 2017 hung-nb 0

SQL Server Management Studio How to find a certain string inside a stored procedure/ function [sql]SELECT OBJECT_NAME(object_id) FROM sys.sql_modules WHERE OBJECTPROPERTY(object_id, ‘IsProcedure’) = 1 AND […]

No Image

SQL statements – SELECT

July 2, 2017 hung-nb 0

How to know number of rows being affected by SELECT/INSERT/UPDATE…? SQL Server[sql] UPDATE Employee SET JobTitle = N’Executive’ WHERE NationalIDNumber = 123456789 IF @@ROWCOUNT = […]

No Image

Query tuning

June 16, 2017 hung-nb 0

General Speed depends much on indexes than other things JOIN is quicker than IN Index Index improves performance of SELECT queries Index should be applied […]