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 2012 Forums
 Transact-SQL (2012)
 case statement

Author  Topic 

gaviliv
Starting Member

1 Post

Posted - 2014-03-06 : 11:29:26
I am trying to update columns in a table based on join condition and included in create statement using case statement:

Following is part of create statement:

[SAV Sub-Segment] AS (case when ([Validated End Customer Name]=[dbo].[SLED_VAL-GM-MAPPING].[SAV Name]) THEN [dbo].[SLED_VAL-GM-MAPPING].[SAV Sub Segment ] else NULL end),

and get the following error
"The multi-part identifier "dbo.SLED_VAL-GM-MAPPING.SAV Name" could not be bound."

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2014-03-06 : 15:40:05
quote:
Originally posted by gaviliv

I am trying to update columns in a table based on join condition and included in create statement using case statement:

Following is part of create statement:

[SAV Sub-Segment] AS (case when ([Validated End Customer Name]=[dbo].[SLED_VAL-GM-MAPPING].[SAV Name]) THEN [dbo].[SLED_VAL-GM-MAPPING].[SAV Sub Segment ] else NULL end),

and get the following error
"The multi-part identifier "dbo.SLED_VAL-GM-MAPPING.SAV Name" could not be bound."

Does your join include the table dbo.SLED_VAL-GM-MAPPING? If it does, is it aliased?

Would be easier to identify the problem if you post the entire query, or at least everything in the FROM clause.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2014-03-10 : 05:13:26
quote:
Originally posted by gaviliv

I am trying to update columns in a table based on join condition and included in create statement using case statement:

Following is part of create statement:

[SAV Sub-Segment] AS (case when ([Validated End Customer Name]=[dbo].[SLED_VAL-GM-MAPPING].[SAV Name]) THEN [dbo].[SLED_VAL-GM-MAPPING].[SAV Sub Segment ] else NULL end),

and get the following error
"The multi-part identifier "dbo.SLED_VAL-GM-MAPPING.SAV Name" could not be bound."



The syntax is wrong. It should be

[SAV Sub-Segment] =(case when ([Validated End Customer Name]=[dbo].[SLED_VAL-GM-MAPPING].[SAV Name]) THEN [dbo].[SLED_VAL-GM-MAPPING].[SAV Sub Segment ] else NULL end),

Madhivanan

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

- Advertisement -