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.
Author |
Topic |
khanewal
Starting Member
33 Posts |
Posted - 2010-08-18 : 09:03:39
|
HI Friends,Actually I got output but not sure how to insert this output into another table can you plz give me some idea, thanks,Query:SELECT substring(docid,1,10)+substring(filename,1,4) AS [Documnet ID],x1 AS X,y1 AS Y,x2-x1 AS Width,y2-y1 AS Hight,c.pageid FROMtraining.dbo.main ainner join training.dbo.main_pages b on b.mainid = a.mainidinner join dbo.[objects] c on c.page_id = b.page_idResults:E.0626.0123 6 0 387 123 39E.0626.0123 0 2148 638 190 39E.0626.0125 0 0 373 175 40E.0626.0127 0 2156 377 182 41E.0626.0124 1275 2145 373 193 42E.0626.0124 0 0 526 249 42E.0626.0126 1154 2142 494 196 43 |
|
senthil_nagore
Master Smack Fu Yak Hacker
1007 Posts |
Posted - 2010-08-18 : 09:12:58
|
Insert into <table_name> (col1,col2,col3,....)SELECT substring(docid,1,10)+substring(filename,1,4) AS [Documnet ID],x1 AS X,y1 AS Y,x2-x1 AS Width,y2-y1 AS Hight,c.pageidFROMtraining.dbo.main ainner join training.dbo.main_pages b on b.mainid = a.mainidinner join dbo.[objects] c on c.page_id = b.page_idSenthil.C------------------------------------------------------[Microsoft][ODBC SQL Server Driver]Operation canceledhttp://senthilnagore.blogspot.com/ |
|
|
vaibhavktiwari83
Aged Yak Warrior
843 Posts |
Posted - 2010-08-18 : 09:44:01
|
quote: Originally posted by senthil_nagore Insert into <table_name> (col1,col2,col3,....)SELECT substring(docid,1,10)+substring(filename,1,4) AS [Documnet ID],x1 AS X,y1 AS Y,x2-x1 AS Width,y2-y1 AS Hight,c.pageidFROMtraining.dbo.main ainner join training.dbo.main_pages b on b.mainid = a.mainidinner join dbo.[objects] c on c.page_id = b.page_idSenthil.C------------------------------------------------------[Microsoft][ODBC SQL Server Driver]Operation canceledhttp://senthilnagore.blogspot.com/
make sure number of columns and datatype in insert list should match with the select list columns.Vaibhav TTo walk FAST walk ALONE To walk FAR walk TOGETHER |
|
|
khanewal
Starting Member
33 Posts |
Posted - 2010-08-18 : 19:47:57
|
I have to get one column value from the below query, how I will fit in the above query, to insert into table ???SELECT b.FileGuid,b.X, b.Y, b.Width, b.Height FROM SERVER1.DBNAME.DBO.[FILENAME] aJOIN SERVERNAME.DBNAME.DBO.TableName b ON a.[guid] = b.fguidThanks,1c5ec1fb-9018-4a60-bbfc-e27b455a0483 337 364 500 1501c5ec1fb-9018-4a60-bbfc-e27b455a0483 337 364 500 1501c5ec1fb-9018-4a60-bbfc-e27b455a0483 20 15 500 2501c5ec1fb-9018-4a60-bbfc-e27b455a0483 20 15 500 250 |
|
|
vaibhavktiwari83
Aged Yak Warrior
843 Posts |
Posted - 2010-08-19 : 03:05:28
|
quote: Originally posted by khanewal I have to get one column value from the below query, how I will fit in the above query, to insert into table ???
Which column you want to get You can go for - INSERT INTO <Your Table> (Column list...)SELECT <Desired Column list>FROM (<Your original query>) A Vaibhav TTo walk FAST walk ALONE To walk FAR walk TOGETHER |
|
|
|
|
|
|
|