Pages

Tuesday 15 January 2013

Delay Function in SQL Server

The Delay function used to execution of a batch in block, stored procedure, or transaction until a specified time or time interval is reached, or a specified statement modifies or returns at least one row.

While executing the WAITFOR statement, the transaction is running and no other requests can run under the same transaction.

Remarks:
Ø  If a query cannot return any rows, WAITFOR will wait forever or until TIMEOUT is reached, if specified.
Ø  WAITFOR statements not used in Views and Cursor.
Ø  When the query exceeds the query wait option, the WAITFOR statement argument can complete without running. You can create a Deadlock by running a query with WAITFOR.

Example:
SELECT GETDATE() CurrentDateTime
WAITFOR DELAY '00:00:05' ---- 5 Second Delay
SELECT GETDATE() CurrentDateTime


Note: You can also perform update, DB Backup and Restore and many important operation easily using this command.














Monday 14 January 2013

What is X and Z report in POS(Point of Sale)

The format and contents of X report and Z report are mostly same. It may contain following main content and it may vary based on requirement:
1) Date and Time the report was perform
2) Identification Information (Shift/Batch related information)
3) Opening and closing balance
4) Discount, Total sales, Void transaction and many more
5) Tax, promotions, vouchers related information etc

Now the main question is what is the difference between X report and Z report, which is listed below:
X Report
Z Report
It shows current shift/batch information in details without closing shift/batch.
It closed current running shift and open new shift.
User can print it any time in a day to check transaction details.
It’s more preferable to print it at the end of day.

Sunday 6 January 2013

SET FMTONLY in SQL Server

It returns only SQL table definition to user. It can be used to test the format of the response without actually running the query. It returns the column information only; no rows of data are returned.

Syntax: SET FMTONLY { ON | OFF }

1) SET FMTONLY ON Example:














2) SET FMTONLY OFF Example: