Pages

Search This Blog

Showing posts with label SQL SERVER. Show all posts
Showing posts with label SQL SERVER. Show all posts

Saturday, 21 June 2014

Database connection in ASP.NET



Hi friends, in this session I will say how to add database into our visual studio. So you can use that database tables in your application.

Let us take an example and I will show how to add database into our application.

Here I have created a database which is named as “blood_bank” and my server name was “sqlexpress”. I will show how to add that database into our application....




That’s it, Now you can use your database tables in your application...... J

 You can rate my ASP.NET classes on right side top of my blog.......


                                                                             -Your's santoshklpkl

Tuesday, 20 May 2014

Basic Commands that we use in Sql while creating project....

Hi friends, today I will say you about basic Sql commands that we use while creating our project.

1) Create
2) Insert
3) Update
4) Delete

Create Table Statement
    CREATE TABLE "table_name"
("column 1" "data type for column 1" [column 1 constraint(s)],
"column 2" "data type for column 2" [column 2 constraint(s)],
...
[table constraint(s)]);

·        Drop Table Statement
DROP TABLE "table_name";

·        Truncate Table Statement
TRUNCATE TABLE "table_name";

·        Insert Into Statement
INSERT INTO "table_name" ("column1", "column2", ...)
VALUES ("value1", "value2", ...);

·        Update Statement
UPDATE "table_name"
SET "column_1" = [new value]
WHERE "condition";

·        Delete From Statement
DELETE FROM "table_name"
WHERE "condition";

·        Alter Statement
ALTER TABLE tb_TableName ADD Record_Status varchar(20);

ALTER TABLE tb_TableName 

add constraint cnt_Record_Status Default '' for Record_Status;

Six types of constraints can be placed when creating a table:

·        NOT NULL Constraint: Ensures that a column cannot have NULL value.

·        DEFAULT Constraint: Provides a default value for a column when none is specified.


·        UNIQUE Constraint: Ensures that all values in a column are different.

·        CHECK Constraint: Makes sure that all values in a column satisfy certain criteria.

·        Primary Key Constraint: Used to uniquely identify a row in the table.

·        Foreign Key Constraint: Used to ensure referential integrity of the data.

SQL > SQL Syntax
In this page, I have listed the SQL syntax for each of the SQL commands in this tutorial, making this an easy reference for someone to learn SQL.

·       Select Statement
   SELECT "column_name" FROM "table_name";

·        Distinct
SELECT DISTINCT "column_name"
FROM "table_name";

·        Where
SELECT "column_name"
FROM "table_name"
WHERE "condition";

·        And/Or
SELECT "column_name"
FROM "table_name"
WHERE "simple condition"
{[AND|OR] "simple condition"}+;

·        In
SELECT "column_name"
FROM "table_name"
WHERE "column_name" IN ('value1', 'value2', ...);

·        Between
SELECT "column_name"
FROM "table_name"
WHERE "column_name" BETWEEN 'value1' AND 'value2';

·        Like
SELECT "column_name"
FROM "table_name"
WHERE "column_name" LIKE {PATTERN};

·        Order By
SELECT "column_name"
FROM "table_name"
[WHERE "condition"]
ORDER BY "column_name" [ASC, DESC];

·        Count
SELECT COUNT("column_name")
FROM "table_name";

·        Group By
SELECT "column_name1", SUM("column_name2")
FROM "table_name"
GROUP BY "column_name1";

·        Having
SELECT "column_name1", [Function("column_name2")]
FROM "table_name"
[GROUP BY "column_name1"]
HAVING (arithematic function condition);
    
    You can rate my class on right side top of my blog......
    
                                                        -Your's santoshklpkl



·        

Wednesday, 14 May 2014

"Don't Know how to write queries in Sql ??" Then here there is a solution.....

Hi friends, today I will show you “How to create tables in Sql Server Management studio”

The simplicity of Sql Server Management Studio is we need not write queries for the creation of tables, databases and to the constraints to them. 

The following video will show you "How create database and tables directly without writing any queries"



You can rate my class on right side top of my blog.....

                                                                -Your's santoshklpkl

Tuesday, 13 May 2014

What is procedure?? What is use of it ?? When we use it ??

Hi friends, today I will show you “How to create procedures in Sql Server Management studio”

Normally at the back-end of the application we write commands directly. 

In some cases we need to pass many values at a time. In such cases writing query was so difficult.

In some cases we need to store the value in more than 1 table in simple words we have to execute more than 1 query at a time. In such cases we use procedures.


The following video will show you “How to create procedures” 


You can rate my class on right side top of my blog .... 

                                                                    -Your's santoshklpkl

Saturday, 10 May 2014

How to install Sql Server Management Studio ....

Hi friends, till now I said about front-end Visual studio.... We need a back-end also for storing data and retrieving data. We can use any server. Here I am showing "How to install Sql Server Management Studio 2008 today".

STEP 1: DownloadMicrosoft® SQL Server® 2008 ManagementStudioExpress  and select either SQLManagementStudio_x64_ENU.exe or SQLManagementStudio_x86_ENU.exe depending on your machine’s OS bit-ness. I’m running Windows 7-64bit so I’ll be detailing the steps as it pertains to that OS

STEP 2: Make sure you’re logged in as an administrator of the machine then right-click on the exe you downloaded and select “Run as Administrator”. If you’re on Windows 7 then you’ll get a compatibility warning. Click past it for now to continue with the install. Later you’ll need to apply SQL 2008 Service Pack 2.

STEP 3: You should now see the “SQL Server Installation Center” window. Yes it looks scary. Select the “Installation” tab.


STEP 4: Select “New SQL Server stand-alone installation or add features to an existing installation”. It will then run a rule check. Make sure there are no failures and then click OK.


STEP 5: The next step is misleading. The Setup Support Files window looks like it’s doing something and stuck on “Gathering user settings.” It’s actually waiting for you to click the Install button!


STEP 6: Another rule check. You’ll probably end up with a Windows Firewall warning this time. If you want to enable remote access to SQL Server you’ll need to configure the firewall later. Since I’m using SQL Server Express for development purposes on this machine only, I won’t need to worry about that. Click Next.


STEP 7: Okay here is the step I always mess up because it’s just not intuitive at all. On the Installation Type window you have a choice between “Perform a new installation of SQL Server 2008” OR “Add features to an existing instance of SQL Server 2008”. You need to select new installation, NOT add features. I know I know, totally weird. You would think that since you just want to add SSMS that it would be Add features to existing instance – I mean I don’t want a new instance, just the dang tools. Sigh. Click Next.


STEP 8: Next you get the Product Key window. You obviously don’t need a product key for SQL Server Express since it’s free so just click Next.


STEP 9: Accept the License Terms and click Next.


STEP 10: Okay now for the window we’ve all been waiting for - Feature Selection. Check off “Management Tools – Basic” and then click Next.


STEP 11: Verify your disk space requirements and click Next.


STEP 12: Help Microsoft improve SQL Server features and services by selecting to send usage and error reports to them (or not). Click Next.

STEP 13: Another quick rule check runs. Click Next.

STEP 14: Now it looks like we’re ready to install. Click the Install button.

The install will kick off and will take about 5 minutes to complete.

STEP 15: Once the installation completes, click the Next button again.


STEP 16: Complete! Click the Close button and you should be all set.


STEP 17: Fire up SQL Server Management Studio! You should now see it in your Programs under Microsoft SQL Server 2008. Make sure you run it as an administrator for access to all the features.


You can rate my class on right side top of my blog.....
  
                                                                       -Your’s santoshklpkl



Animated Social Gadget - Blogger And Wordpress Tips Twitter Bird Gadget