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)
 Proble Multi-part identifier

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?

Thanks

Goodnight

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
Go to Top of Page

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.num

As said it will return only one name

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

bubix
Starting Member

24 Posts

Posted - 2005-11-21 : 02:58:29
Thanks,

I replace where by inner join like this:

as
begin
declare @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 execute

What is the problem??

We cannot use loctable in "inner join"???

Thanks
Must declare
Go to Top of Page

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
begin
declare @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 execute

What is the problem??

We cannot use loctable in "inner join"???

Thanks
Must 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.num


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

bubix
Starting Member

24 Posts

Posted - 2005-11-21 : 05:26:19
Sorry madhivanan,

I 'll try like your answer.

Really sorry!
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-11-21 : 07:00:52
No problem

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -