The Alias name is the name that is referred to any column name or table name that is given by user. The alias name also used to represent some column or table without using its real name. As we will proceed in this article we will see that how we can use both the alias column name and alias table name in SQL Server.
The Cast() Function is used to change the data type of a column. We can use the cast() function for various purpose.
Cast(Original_Expression as Desired_DataType) Read More →
In this article we will see that how can use and execute the SQL Commands in Visual Studio. In this article we are using C# language. As we proceed in this article you will see that what steps are required to perform this task. We need the two main classes to do this. These classes are SqlConnection and SqlCommand. Â First we will use to include the namespaces that are required to using these two classes. First we will include two namespaces by using ‘using’ keyword. After importing this namespaces we will create the object for SqlConnection and SqlCommand.
Today we will learn that how to use an if-else statement while inserting records into the database. We are talking about the SQL Server database. To understand this example we are understanding a problem that will make easy to Â learn if-else statement. Our problem is we want to insert a record into the table named “StudentRecord”. This table have two columns named ‘student_name’ and ‘student_gender’. We will pass the name and gender as parameter in the stored procedure. Now we have to edit the name according to his/her gender. for example if the student_gender = ‘Male’ then we will add ‘Mr.’ before the name of student. Similarly if the student_gender = ‘Female’ then we will add ‘Mrs/Miss’ before the name of student. Now we are showing that how this task will be done.
While working with database we need to store our information time to time. and for that purpose we take the backup for that database. Backing up a database provide many solutions for us. The main thing is if we lost our database from SQL Server then we can restore our database from our computer. Also when we perform changes in our database the backup database automatically update the changes to the backup file. In this article we are going to create a backup file of Database. The backup file always contain the extension (.bak). Also we are going to learn how to restore the database later in the article.
Hello guys, I hope you are enjoy reading article. Today we are going to discuss the Constraints that we need to use in SQL while programming. Some time we need to put some type of restriction on the column of the table. These restriction are called constraints. Also we are going to discuss the types of Constraints in this article. We use constraints to bound the column so that we can perform any operation according to our requirement. Using constraints we can increase our security of database as well as we can co-relate more tables with each other…
Control-of-flow statements are very must for any programming language. A complete project can not be completed without any condition. And when we talk about the condition there are various types of control statements in T-SQL. Today we will discuss first If statement then If-Else statements in T-SQL. If-Else statements do the same task as for any other language. It checks for a condition if the condition is true then execute the “IF” part otherwise executes the “ELSE” part. And then we will learn how to grouping code into blocks so that we can perform various operation in single If or Else condition.Â Read More →
While programming in SQL Server some time we need to do something more than just creating Tables and Stored Procedure. Somtime we need to access a user define Â variable inside the SQL script. The variable is the name of the memory location that stores some specific value. and also another property of variable is that its value can be vary or we can say that its value can be changed multiple time during the execution of the program. In this article I will tell you that how to declare a variable in SQL server as well as how can we assign any value in the variable. Also we will discuss the ways of assigning values later in this article.