0% found this document useful (0 votes)
71 views1 page

SQL Quries

This document contains 3 SQL queries. The first query selects the table name, schema name and column name from sys.tables and sys.columns and orders the results by schema name and table name. The second query selects several fields from the tblSalWorkOrder and tblSalWorkOrderDetail tables where the TransID fields match. The third query selects the Name and OrderNo fields by joining the tblTelephoneDirectory and tblSalWorkOrder tables on the AccID and CustomerCode fields respectively.

Uploaded by

Shahid Nadeem
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
71 views1 page

SQL Quries

This document contains 3 SQL queries. The first query selects the table name, schema name and column name from sys.tables and sys.columns and orders the results by schema name and table name. The second query selects several fields from the tblSalWorkOrder and tblSalWorkOrderDetail tables where the TransID fields match. The third query selects the Name and OrderNo fields by joining the tblTelephoneDirectory and tblSalWorkOrder tables on the AccID and CustomerCode fields respectively.

Uploaded by

Shahid Nadeem
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

SELECT t.

name AS table_name,
SCHEMA_NAME(schema_id) AS schema_name,
c.name AS column_name
FROM sys.tables AS t
INNER JOIN sys.columns c ON t.OBJECT_ID = c.OBJECT_ID
ORDER BY schema_name, table_name;

SELECT tblSalWorkOrder.CustomerCode, tblSalWorkOrder.OrderNo,


tblSalWorkOrderDetail.PipeSize, tblSalWorkOrderDetail.LengthFtPerMtr,
tblSalWorkOrderDetail.NoOfPipe, tblSalWorkOrderDetail.WeightMTons
FROM tblSalWorkOrder
INNER JOIN tblSalWorkOrderDetail ON tblSalWorkOrder.TransID =
tblSalWorkOrderDetail.TransID

SELECT tblTelephoneDirectory.Name, tblSalWorkOrder.OrderNo


FROM tblTelephoneDirectory
INNER JOIN tblSalWorkOrder ON tblTelephoneDirectory.AccID = tblSalWorkOrder.CustomerCode;

You might also like