Wednesday, December 20, 2017

How to find all triggers on a table in sql server ?

How to find all triggers on a table in sql server ?

=>

SELECT NAME, PARENT_ID, CREATE_DATE, MODIFY_DATE, S_INSTEAD_OF_TRIGGER  
FROM SYS.TRIGGERS  WHERE TYPE = 'TR';

     I am create one trigger  in sql server.trigger name like test trigger create then run above query to find your result.display all trigger in database and all table see output.

Output:-


Saturday, December 9, 2017

How to get SQL database connection string in 5 simple steps

Step 1 : First Open Server Explorer in your Visual Studio IDE


Step 2 : Now click on + button for open connection dialog


Step 3 : now paste your Server Name for get database list



Step 4 : when you paste your server name 1 Dropdown list is open for select database now select your database


Step 5 : now click on Advance button and get your connection string



Happy developing....

How to use case when in sql query

In this  example first declare 1 variable for store value you can also use case when in SQL query

DECLARE @Type Int

--  Set value in declared variable
SET @Type = 1

-- now use case when like this normally it's just like if & else if condition

SELECT (CASE
        WHEN @Type = 1 THEN 'Red'           [if type = 1 { 'red' } ]
        WHEN @Type = 2 THEN 'Green'
        WHEN @Type = 3 THEN 'Blue'
        ELSE 'No Colors' END)

SQL Datatype

SQL DataType

1. BigInt
    From C# side it stores Int64 Value
    MaxValue = 9223372036854775807
    MinValue = -9223372036854775808


2. Bit
    C# : Store Bool Value Like True or False 
 
3. DateTime
    C# : Store Date Time

4. Float
    C# : Store Float Value
    MaxValue = 3.40282e+038f
    MinValue = -3.40282e+038f


5. Int
    C# : Store Int32 Value
    MaxValue = 2147483647
    MinValue = -2147483648


6. Numeric(18,0)
    SQL store value like 18 digits with 2 or more decimal place
    e.g. 12.00


7. Nvarchar(50)
    SQL store Text & unique code value with limited size

8. Nvarchar(MAX)
    SQL store Text & unique code value no limit for store data

9. Varchar(50)
    SQL store only text Varchar datatype do not support unique code value

10. Varchar(MAX)
    SQL store only text Varchar datatype do not support unique code value

11. Uniqueidentifier
    SQL store Numeric, Characters, and - with the lenth of 36 characters
    Uniqueidentifier do not repeat it generate unique value every time
    C# : store GUID value

How to Install SQL Sever 2008 R2?

How to Install SQL Sever 2008 R2?

=>   Sql Server Installation Step Follow Bellow : - 

1) First of all download sql server management studio 2008 then click setup see image 


2) Second step display installation dialog box see image


3) Third step display SQL Server Installation Center Then select "New Installation or add features to an existing installation" Text click see image



4) Then display setup support  rules dialog box see image


5) This step is display license terms then by default two checkbox is unselected display see image


6) This step is select two checkbox then enable next button see image


7) This step is display feature selection then click next button see image


8) This step is display error reporting dialog then click next button see image



9) This step is display complete installation see image 


10) This step is display your setup is ready to user create new database see image