|
|
-
|
|
Today i studied an interesting thing related to GO statment
See in the following queries executed .***The batch preceding GO will execute the specified number of times***.
create table test( id int not null identity (1, 1) primary key)
go
...
|
|
-
|
|
It's quite old, but new for me. Great method to parse string is using of recursive CTE, as showed in Table Function:
CREATE FUNCTION fn_SplitString(@str NVARCHAR(MAX), @sep NVARCHAR(MAX))
RETURNS TABLE
AS
RETURN
(
WITH sepPos ...
|
|
-
20 Liked
| 25 Learned
| 13 Comments
|
|
Recently read an article, which explains the surprising trick to reveal the folder which has all system management shortcuts.
1. Create a new folder in any of drives.
2. Rename the folder with the text "GodMode.{ED7BA470-8E54-465E-825C-99712043E01C}......
|
|
-
10 Liked
| 6 Learned
| 13 Comments
|
|
As sharing my experience while using SP_HELPTEXT to get stored procedure text in SQL Server and ran into issue.
Issue 1. It will remove setting of the stored procedures like "set quoted_identifier on" or any other if using at the top of the stored ......
|
|
-
|
|
Recently I needed to convert a float value to nearest integer...
I used Convert.ToInt32
The problem found with is it will convert decimal like 7.5,8.5 to nearest even integer
Convert.ToInt32(7.5)=>8
Convert.ToInt32(8.5)=>8 !!!
The solution f...
|
|
-
|
|
This script shows how to find the beginning of current financial year (for countries using April 1 as the beginning) using TSQL.
SELECT
DATEADD(dd,0,
DATEDIFF(dd,0,
DATEADD(
mm,
-(((12 + DATEPART(m, getDate())) - 4)%12),
g...
|
|
-
17 Liked
| 10 Learned
| 12 Comments
|
|
Sometimes it happens that we need random row (or set of randoms rows) from table.
Itzik Ben-Gan shows us, in one of his book, the efficient way to do this:
SELECT TOP(1) * FROM someTable ORDER BY NEWID()
Changing the value in TOP operator, we can, in...
|
|
-
22 Liked
| 9 Learned
| 12 Comments
|
|
From a disconnected query window, we can connect back to the SQL Server instance from the **Query > Connection > Connect** menu option. This may sound simple, but I found this interesting.
I usually press F5 (or execute button) twice to get connected a...
|
|
-
16 Liked
| 12 Learned
| 11 Comments
|
|
Hi,
We know the hint , how to get all the column names of a table into query window using drag and drop of Columns Folder under TableName.
![SSMS Hint][1]
Today , i learned another method to do the same,
**Select the query** and **right click** on...
|
|
-
10 Liked
| 8 Learned
| 11 Comments
|
|
T-SQL's ISNUMERIC() function has a problem. It can falsely interpret non-numeric letters and symbols (such as D, E, and £), and even tabs (CHAR(9)) as numeric.
...
|
|