| Author |
Topic |
|
sunsanvin
Master Smack Fu Yak Hacker
1274 Posts |
Posted - 2007-07-24 : 01:03:17
|
| Dear experts,please tell me where is the error in my code?create function getitemid(@uomid varchar(50))returns tableas begindeclare @itemid varchar(50)select @itemid= column01 from table21 where column03=(select dbo.getuomid('no of leaves'))return (@itemid)endgoVinodEven you learn 1%, Learn it with 100% confidence. |
|
|
pbguy
Constraint Violating Yak Guru
319 Posts |
Posted - 2007-07-24 : 01:14:50
|
| you have declared the function will return Table but it returns varchar--------------------------------------------------S.Ahamed |
 |
|
|
sunsanvin
Master Smack Fu Yak Hacker
1274 Posts |
Posted - 2007-07-24 : 01:18:34
|
| create function getitemid(@uomid varchar(50))returns varchar(50)as begindeclare @itemid varchar(50)select @itemid= column01 from table21 where column03=(select dbo.getuomid('no of leaves'))return (@itemid)endgonow it is giving one value.actually that will give the values around 280. i need all the 280 valuesVinodEven you learn 1%, Learn it with 100% confidence. |
 |
|
|
pbguy
Constraint Violating Yak Guru
319 Posts |
Posted - 2007-07-24 : 01:35:30
|
| Use inline table-valued functioncreate function getitemid(@uomid varchar(50))returns tableas Return(select column01 from authors where column03=(select dbo.getuomid('no of leaves')))--------------------------------------------------S.Ahamed |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-07-24 : 02:22:29
|
| create function getitemid(@uomid varchar(50))returns tableas Return(select column01 from authors where column03=dbo.getuomid('no of leaves'))Peter LarssonHelsingborg, Sweden |
 |
|
|
sunsanvin
Master Smack Fu Yak Hacker
1274 Posts |
Posted - 2007-07-24 : 02:50:35
|
| dear folks,now it's as per my requirement, that i'm getting the 280 values.now i've to update one table based on these results.I've to put all the 280 rows (i mean only one column in the format) in columnb2 of table19 likeinsert into table19.columnb2 select * from dbo.getitmid('1ca7a0fa-c507-4d4d-94a1-13eb9ec3d6d2')please give me the query or procedurethanks in advanceVinodEven you learn 1%, Learn it with 100% confidence. |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-07-24 : 02:54:37
|
| It would be much easier if you posted your FULL and COMPLETE problem description the first time.Now we have to read this topic over and over again! Complete waste of time...You should use UPDATE if you want to UPDATE "one table". For this, you need to know how to bind the two resultset together.Peter LarssonHelsingborg, Sweden |
 |
|
|
sunsanvin
Master Smack Fu Yak Hacker
1274 Posts |
Posted - 2007-07-24 : 02:58:48
|
| Dear Peso,I've already posted the entire requirement. but i dont know why i was unable to get help from you all. i thought it was because of me(may be failed to give you the proper information)that's why i've tried in different ways, and posted like that....sorry for troubling. http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=86530VinodEven you learn 1%, Learn it with 100% confidence. |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
|
|
|