| Author |
Topic  |
|
|
khanewal
Starting Member
Australia
33 Posts |
Posted - 08/18/2010 : 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 FROM training.dbo.main a inner join training.dbo.main_pages b on b.mainid = a.mainid inner join dbo.[objects] c on c.page_id = b.page_id
Results:
E.0626.0123 6 0 387 123 39 E.0626.0123 0 2148 638 190 39 E.0626.0125 0 0 373 175 40 E.0626.0127 0 2156 377 182 41 E.0626.0124 1275 2145 373 193 42 E.0626.0124 0 0 526 249 42 E.0626.0126 1154 2142 494 196 43 |
|
|
senthil_nagore
Flowing Fount of Yak Knowledge
India
1006 Posts |
Posted - 08/18/2010 : 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.pageid FROM training.dbo.main a inner join training.dbo.main_pages b on b.mainid = a.mainid inner join dbo.[objects] c on c.page_id = b.page_id
Senthil.C ------------------------------------------------------ [Microsoft][ODBC SQL Server Driver]Operation canceled
http://senthilnagore.blogspot.com/
|
 |
|
|
vaibhavktiwari83
Aged Yak Warrior
India
837 Posts |
Posted - 08/18/2010 : 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.pageid FROM training.dbo.main a inner join training.dbo.main_pages b on b.mainid = a.mainid inner join dbo.[objects] c on c.page_id = b.page_id
Senthil.C ------------------------------------------------------ [Microsoft][ODBC SQL Server Driver]Operation canceled
http://senthilnagore.blogspot.com/
make sure number of columns and datatype in insert list should match with the select list columns.
Vaibhav T
To walk FAST walk ALONE To walk FAR walk TOGETHER |
 |
|
|
khanewal
Starting Member
Australia
33 Posts |
Posted - 08/18/2010 : 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] a JOIN SERVERNAME.DBNAME.DBO.TableName b ON a.[guid] = b.fguid
Thanks,
1c5ec1fb-9018-4a60-bbfc-e27b455a0483 337 364 500 150 1c5ec1fb-9018-4a60-bbfc-e27b455a0483 337 364 500 150 1c5ec1fb-9018-4a60-bbfc-e27b455a0483 20 15 500 250 1c5ec1fb-9018-4a60-bbfc-e27b455a0483 20 15 500 250
|
 |
|
|
vaibhavktiwari83
Aged Yak Warrior
India
837 Posts |
Posted - 08/19/2010 : 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 T
To walk FAST walk ALONE To walk FAR walk TOGETHER |
 |
|
| |
Topic  |
|
|
|