Create Fibonacci sequenc

In SQL Server, You can create the fibonacci Seriense user the SQL Command. -- Fibonacci Series ;with fibo as ( select 1 as fibA, 1 as fibB, 1 as seed, 1 as  num union all select (seed + fibA)fibA , (fibA + fibB) fibB, fibA as seed, (num+1) as num from fibo where num<12 )... Continue Reading →

Find out SQL Objects by Datatype

I want to find out the table list with column, which column datatype has tinyint. So that i want to replace tinyint to int in Database. Here is given a simple SQL query which has find out the table list with column.   SELECT OBJECT_NAME(c.OBJECT_ID) TableName, c.name ColumnName FROM sys.columns AS c JOIN sys.types AS... Continue Reading →

Generate the Dynamically Insert / Update T-SQL statement.

There is big problem when no of tables which need to insert / update the records dynamically. User only passes table name , column list with comma seperated char and last one value list with comma seperated char. Here is single sp can create to use for get INSERT / UPDATE (T-SQL Statement) for executting... Continue Reading →

Count Character or words using T-SQL

Here is a simple way to get a specific character or Words count. How many times character or words is in given a string. Declare @myvar varchar(max),  @tocount varchar(20) set @myvar = 'Hello World, Hello World 5 (sandip and patel) (sql) 3 (developer) 4 and SEO and 4 Dotnet developer' set @tocount = 'and' select... Continue Reading →

SSMS – Keyboard Shortcuts.

SQL Developer need to help while SQL querying in SSMS with some Shortcuts here. WAITING FOR FEEDBACK. I hope you will get some tips while programming with SQL Server. I would like to you, to leave a comment on this post. Your valuable feedback, question, or comments for this article are always welcome.

Find Tables With Foreign Key Constraint in Database.

Here is the SQL Statement for finding a foreign key constraints in database. This script is mostly used when user need to truncate the table, during this time he has harden to foreign key constraint first to remove it then truncate table. SELECT f.name AS ForeignKeyName, OBJECT_NAME(f.parent_object_id) AS TableName, COL_NAME(fc.parent_object_id, fc.parent_column_id) AS ColumnName, OBJECT_NAME (f.referenced_object_id)... Continue Reading →

SQL Server Naming Conventions and Standards

standard naming Conventions for sql server, stored procedure naming conventions, functions indexes constraints tables naming conventions

SQL Self Join

A self join is one the join in which a table is joined with itself (is called as Unary relationships),  To join a table itself means that each row of the table is combined with itself and with every other row of the table. The syntax of the command for joining a table to itself... Continue Reading →

Finding users that are connected to the server

The following example finds the users that are connected to the server and returns the number of sessions for each user. SELECT login_name ,COUNT(session_id) AS session_count FROM sys.dm_exec_sessions GROUP BY login_name;

Blog at WordPress.com.

Up ↑

Design a site like this with WordPress.com
Get started