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
 General SQL Server Forums
 New to SQL Server Programming
 Join with contain Help

Author  Topic 

masond
Constraint Violating Yak Guru

447 Posts

Posted - 2013-08-15 : 07:00:51
Hey guys

I am hoping this is the last question of the day
Aim – There are various lengths of MID_External and MID_Internal in the [FDMS].[SalesForce].[DailyAccounts] table.
I want to find some kind of match from [FDMS].[SalesForce].[DailyAccounts] into [FDMS].[dbo].[stg_LMPAB502] where ,[Client_Conf] = ‘Y’

The length of FDMSaccountno is 12 and the length of external_Id is 15 in table [FDMS].[dbo].[stg_LMPAB502]. This is the correct length for these appropiate fields

SELECT [FDMSAccountNo]
,[External_ID]
,[Client_Conf]
FROM [FDMS].[dbo].[stg_LMPAB502]
MID_Internal = FDMSaccountno
MID_External = [External_ID]

Would appreciate any help available

Eg results
Mid_internal 870650888 = Length 11
Fdmdaccountno 878306508887 = Length 11
would be a match

MuMu88
Aged Yak Warrior

549 Posts

Posted - 2013-08-15 : 10:22:01
It is not clear what you want, if you want to verify the length of a field you can do this:
[CODE]

SELECT [FDMSAccountNo]
,[External_ID]
,[Client_Conf]
FROM [FDMS].[dbo].[stg_LMPAB502]
(MID_Internal = FDMSaccountno and LEN(MID_Internal) = 11)
and
MID_External = [External_ID]


[/CODE]
Go to Top of Page
   

- Advertisement -