Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Creating table from a query

Author  Topic 

Swati Jain
Posting Yak Master

139 Posts

Posted - 2006-07-28 : 05:08:46
SELECT DISTINCT "SessionDelay"."delayID", "SessionDelayed"."ActualEndDate", "BatchLectureDetails"."lectureFromTime", "BatchLectureDetails"."lectureToTime", "FacultyMaster"."firstName", "FacultyMaster"."middleName", "FacultyMaster"."lastName", "LocationMaster"."locationName", "Batch"."startDate", "Batch"."endDate", "Batch"."batchID", "CourseMaster"."courseName", "FeedBack"."averageFeedBack", "FeedBack"."isLogicalDeleted"
FROM (((("SIEIMSDev"."dbo"."SessionDelay" "SessionDelay" INNER JOIN (("SIEIMSDev"."dbo"."BatchLectureDetails" "BatchLectureDetails" INNER JOIN "SIEIMSDev"."dbo"."Batch" "Batch" ON "BatchLectureDetails"."batchID"="Batch"."batchID") INNER JOIN "SIEIMSDev"."dbo"."FacultyMaster" "FacultyMaster" ON "BatchLectureDetails"."facultyID"="FacultyMaster"."facultyID") ON "SessionDelay"."batchID"="Batch"."batchID") INNER JOIN "SIEIMSDev"."dbo"."SessionDelayed" "SessionDelayed" ON "SessionDelay"."batchID"="SessionDelayed"."batchid") INNER JOIN "SIEIMSDev"."dbo"."CourseMaster" "CourseMaster" ON "Batch"."courseID"="CourseMaster"."courseID") INNER JOIN "SIEIMSDev"."dbo"."LocationMaster" "LocationMaster" ON "Batch"."locationID"="LocationMaster"."locationID") INNER JOIN "SIEIMSDev"."dbo"."FeedBack" "FeedBack" ON "Batch"."batchID"="FeedBack"."batchID"
WHERE ("Batch"."endDate">={ts '1899-12-30 00:00:00'} AND "Batch"."endDate"<{ts '2006-07-23 00:00:00'}) AND "FeedBack"."isLogicalDeleted"=0
ORDER BY "Batch"."batchID")


I want to create a table having columns in above query .How to do that?

nr
SQLTeam MVY

12543 Posts

Posted - 2006-07-28 : 05:10:44
select ....
into mytable
where ....

and get rid of the order by

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2006-07-28 : 05:11:13
how do you determine the data type? pks? fks?

you can make it easier by just typing the fields out, there's not much anyways

--------------------
keeping it simple...
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2006-07-28 : 05:15:14
The datatype will be derived from the datatypes of the result set from the query.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2006-07-28 : 05:25:52
correct, if the objects exists, i'm eyeing those " and { } with suspicion



--------------------
keeping it simple...
Go to Top of Page

DonAtWork
Master Smack Fu Yak Hacker

2167 Posts

Posted - 2006-07-28 : 07:08:25
What do you have against ACCESS?

For fast help, follow this link:
http://weblogs.sqlteam.com/brettk/archive/2005/05/25.aspx

Learn SQL
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp
Go to Top of Page
   

- Advertisement -