Wrong vs Right

Most of the time in our life it happens that we have choose. Funny thing is, we always want options for almost everything and sometime even when we have those we say “OH man .. I wish I would have some option !!”

This is almost obvious that,when we have option we tend to choose the RIGHT one. Now another extremely common thing is  many times our choice really do not come to us the we have thought of and choose it.. than what !!!!!!!

well than we almost all the time say “this choice was WRONG”…I don't know smile

I see a different perspective  (well this post is extremely my personal opinion and do not written to conclude any thing ).

We are the same person and we choose something and after some time later we say my choice was wrong..

one perspective is that we have no idea about it and we really did not CHOOSE from the options.. we have just PICK any one of those …

Another perspective is that we have thought enough before CHOOSING any one of the available option for any particular situation.. Some how it did not work and we blame to our descion. and say it was a WRONG descion!!

I think there is no existence of anything like WRONG ,DARK etc.… these are just another way to say the same thing. This does not mean to create negative energy for us (at lest not from my point of view )

Once upon a time so called “WRONG” descion was  RIGHT when took/choose it .. how this can be WRONG today than..


Things always do not work the way  we want them to .. If we cannot face the failure and do not have any right to get in to the game. A good player must know and learn to agree to defeat/failure .. if this is not the case and someone really always wins.. I do not think he actually is a real winner  Smile

we must observe our available options and situations carefully and choose what we think is best for us AT THAT PERTICULAR TIME

try your best to convert it in success and forget about RIGHT AND WRONG… because there is nothing called WRONG exists.. its just the perspective of seeing thing…


WordPress Tags: Wrong,Most,life,Funny,options,option,perspective,opinion,person,CHOOSE,PICK,Another,situation,Some,existence,DARK,energy,Once,failure,player,winner,situations,PERTICULAR,TIME,TAKE,DESCIONS,MAKE,descion

How to call a user defined function in Check Constraint on table

We can call user defined function in a constraint. This is very helpful when we have to add similar kind of constraint on many tables.

Let’s take an example here

Create a function

CRAETE FUNCTION [TestFucntion] (@Salary nvarchar(50))





      IF(@Salary >1500)


            SET @Exists =0




            SET @Exists =1


RETURN @Exists


Execute the above script and it will create a function which can be seen in object explorer of the selected database, under the function folder.

Create a table employee

Create table Employee (ID int, Salary money)

Add a testConstraint on table employee


Alter TABLE Employee


CHECK(([dbo].[ TestFucntion]([Salary])=(0)))


The above script will add constraint on the table Employee and will not allow entering salary more than 1500.

Thus we can do any other activity here in function and can write complex constraint for table easily.

Create constraints on a column in SQL Server

Hello Friends

Today i was asssigned some work to to put some missing constraints on tables .Adding a constraint sometimes gets very complex so i thought that i should share it with you all how i implemeted it in my scenarios:

(1) Add constraint for sprecial character validation

CREATE TABLE [testtable][ID] [int] NULL,  [Projectname] [nvarchar](200)  ,[pkey] [varchar](200) )

now i want to make sue that Projectname column should no contain any special character apart from ‘_’.

To add a constraint expression for it follow the steps :

(a)Expand testtable tree.

(b)Right click on Constrant folder and select New Constraint option .A new window will appear .

(c) Paste the following expression in the expression area (shown in the newly opened window)

          ([ProjectName] IS NULL OR [ProjectName] like ‘[a-zA-Z_][a-zA-Z0-9_]%’)

(d) Close the window and you are done with it .

(2)Add Constraint for making  column ProjectName Unique

ALTER TABLE testtable WITH CHECK  ADD CONSTRAINT chk_UniqueProjectName UNIQUE ([ProjectName])

For further information click here