|
<< Click to Display Table of Contents >> Navigation: iVend Database Database > User Defined Functions > GetFullAddress User Defined Function |
Navigation: iVend Database Database > User Defined Functions >
iVend 6.6 Database Help
GetFullAddress User Defined Function
Collapse All Expand All
iVend Database Database : GetFullAddress User Defined Function |
Properties
Creation Date |
4/13/2015 12:00 PM |
Encrypted |
|
Ansi Nulls |
|
Parameters
Parameter |
Direction |
Description |
Data Type |
Size |
@addressKey |
In |
|
BigInt |
8 |
@RETURN_VALUE |
Return Value |
|
VarWChar |
4000 |
Objects that GetFullAddress depends on
|
Database Object |
Object Type |
Description |
Dep Level |
|
Table |
Defines the address details for each Address. |
1 |
|
|
Table |
The country details are specified which can be selected further at the addresses entry of the customer/ vendor or which are related to the business in some way. |
1 |
|
|
Table |
The state details are specified which can be selected further at the addresses entry of the customer/ vendor or which are related to the business in some way. |
1 |
Procedure Source Code
CREATE FUNCTION [dbo].[GetFullAddress] ( @addressKey Bigint ) RETURNS NVARCHAR(4000) AS BEGIN DECLARE @fullAddress NVARCHAR(4000) IF NOT EXISTS(SELECT * FROM CfgAddress WHERE AddressKey = @addressKey) BEGIN RETURN '' END SET @fullAddress = '' SELECT @fullAddress = A.Address1 + CASE ISNULL(A.Address2, '') WHEN '' THEN '' ELSE ', ' + A.Address2 END + CASE ISNULL(A.Address3, '') WHEN '' THEN '' ELSE ', ' + A.Address3 END + CASE ISNULL(A.City, '') WHEN '' THEN '' ELSE ', ' + A.City END + CASE ISNULL(B.Description, '') WHEN '' THEN '' ELSE ', ' + B.Description END + CASE ISNULL(C.Description, '') WHEN '' THEN '' ELSE ', ' + C.Description END FROM CfgAddress A LEFT OUTER JOIN CfgState B ON A.StateKey = B.StateKey LEFT OUTER JOIN CfgCountry C ON A.CountryKey = C.CountryKey WHERE A.AddressKey = @addressKey RETURN @fullAddress; END |
See Also
© 2019 All Rights Reserved.
Send comments on this topic.