SQL

Count word in sql server

In this blog i am going to write a function which returns word count in sql server. Sql server does not provide inbuilt function for calculating word count. So we have to write a custom function in sql. CREATE FUNCTION… Continue Reading →

Function, function in sql

System defined functions are provided by SQL itself.
User defined function are two type. First is Scalar and second is Table value.

What is output when we write null = null in where clause

What is output when we write null = null in where clause

Cannot connect to local database in SQL Server

In this article we learn how to resolve the problem while connecting local sql database. Problem: Yesterday, When i was trying to connect my local SQL server database. I found an error called “Cannot connect to PRAMODTHAKUR”.   Solution:  … Continue Reading →

How to find column name within all tables in sql server

Problem I was trying write a procedure with some logic and in that scenario have to find out that how many table contain column-name like “sales” in my database. In my view there is two solution for this may be… Continue Reading →

Toggle in sql server

update NewTable set status= case status when 1 then 0 when 0 then 1 end

Delete duplicate row in sql

In this article we learn that how to delete duplicate row in sql. Let’s create a table and name it NewTable. Create table NewTable ( Name varchar(30), Age int ) Now i am going to insert some demo record in… Continue Reading →

Is it possible to have more than one identity column in sql

I want to create more than one identity column in my table. So is it possible to do that. No, We can not do that. Let’s understand by example. I am trying to create a table which has two column… Continue Reading →

How to get random row in sql server

We can find the random row by using newid() function in sql. I am using sql server 2012 and ReportServer database. select top 1 * from DBUpgradeHistory order by NEWID() I hope this code is helpful. Happy coding

How to get random number in sql server

You can achieve this by following this code. In this code you can find 4 digit random number. select cast(rand() * 10000 as int ) as RandNo If you want 6 digit random number then you use the following code… Continue Reading →