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 |
|
bubix
Starting Member
24 Posts |
Posted - 2005-11-20 : 15:21:09
|
| Hello,I want to do that in the trigger:as begin declare @localTable table(num int, .... declare @var_texte char(50) set @var_texte = (Select name from tableA where tableA.id=@locTable.num)But I have this message when i try execute statements.The multi-part identifier "@locTable.num" could not be bound.Can someone help me ?What is this problem?ThanksGoodnight |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2005-11-20 : 16:55:31
|
set @var_texte = (Select name from tableA join @locTable on tableA.id=@locTable.num)note that this wont work for multiple rows only for one.Go with the flow & have fun! Else fight the flow |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-11-21 : 01:40:35
|
| declare @localTable table(num int, ....declare @var_texte char(50)Select @var_texte = T1.name from tableA T1 inner join @localTable T2 on T1.id=T2.numAs said it will return only one nameMadhivananFailing to plan is Planning to fail |
 |
|
|
bubix
Starting Member
24 Posts |
Posted - 2005-11-21 : 02:58:29
|
| Thanks,I replace where by inner join like this:as begindeclare @locTable table(num int, ...)declare @ var_texte char(50)set @var_texte= Select name from TableA inner join @locTable TableA.id=@locTable.num)But I have this message when I try execute statement:Must declare the scalar variable "@locTable".And If I remove @ before locTable, it's ok, I can executeWhat is the problem??We cannot use loctable in "inner join"???ThanksMust declare |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-11-21 : 03:07:28
|
quote: Originally posted by bubix Thanks,I replace where by inner join like this:as begindeclare @locTable table(num int, ...)declare @ var_texte char(50)set @var_texte= Select name from TableA inner join @locTable TableA.id=@locTable.num)But I have this message when I try execute statement:Must declare the scalar variable "@locTable".And If I remove @ before locTable, it's ok, I can executeWhat is the problem??We cannot use loctable in "inner join"???ThanksMust declare
Did you fully read the code I have given?declare @localTable table(num int, ....declare @var_texte char(50)Select @var_texte = T1.name from tableA T1 inner join @localTable T2 on T1.id=T2.numMadhivananFailing to plan is Planning to fail |
 |
|
|
bubix
Starting Member
24 Posts |
Posted - 2005-11-21 : 05:26:19
|
| Sorry madhivanan,I 'll try like your answer.Really sorry! |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-11-21 : 07:00:52
|
No problem MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|
|