Create XML using SQL Query in SQL Server 2008

Here, we will learn how to create XML using Query: SELECTTOP1000 [Code]       ,[Name]       ,[Price]   FROM[Temp].[dbo].[Product]   FORXML RAW (‘Product’),   ROOT (‘Products’); Here SQL statement “FOR XML RAW” creates one XML node for every corresponding row in database and columns will be created as attributes of that XML node. Results: <Products> <ProductCode=”1″Name=”Computer”Price=”100.0000″/> <ProductCode=”2″Name=”Mobile”Price=”250.0000″/> </Products> SQL ELEMENTS create […]

Read More

How to Create a Table in SQL?

 Create a Table in SQL   Below is the code / syntax to create a table in SQL, The SQL syntax for CREATE TABLE is CREATE TABLE “Table_Name”(“column 1” “datatype_for_column_1”, “column 2” “datatype_for_column_2”, … ) Create Table for Student, the Table name StudentMst with below Column. CREATE TABLE StudentMst ( First_Name char(50), Last_Name char(50), Address […]

Read More

What is SQL?

SQL – Structured Query Language. SQL stands for Structured Query Language. SQL is a globally accepted standard language that is used to handle database related activities for creating database schemas, updating/inserting/deleting of data, retrievieng data, and managing user roles and database activities.   SQL is used to communicate with a database.   it is the […]

Read More