Showing posts with label query. Show all posts
Showing posts with label query. Show all posts

Thursday, 28 May 2015

How to create table in SQL Server Management Studio using SQL query

In SQL Server Management Studio, Althogh there are many ways to create a table using GUI and using query written in SQL.
So simple SQL Query to create a table

SQL CREATE TABLE Syntax

CREATE TABLE table_name
(
column_name1 data_type(size),
column_name2 data_type(size),
column_name3 data_type(size),
....
);

for example: 
Create table Student(
StudentID int,
LastName varchar(255),
FirstName varchar(255),
Address varchar(255),
City varchar(255)
);

Wednesday, 27 May 2015

Convert a number to two decimal places in SQL Server Query

Many a times we get some number(float or double) from our sql query operation. But at the end we need a two decimal number. Then how can we achieve this