Error in merge statement when trying to impliment SCD type 2 using merge...

Hi ,
I'm trying to impliment SCD type 2 using Merge using below blog as reference but sime how it is erroring out with error
http://www.made2mentor.com/2013/08/how-to-load-slowly-changing-dimensions-using-t-sql-merge/
Msg 207, Level 16, State 1, Line 40
Invalid column name 'Current'.
Msg 207, Level 16, State 1, Line 38
Invalid column name 'Current'.
Msg 207, Level 16, State 1, Line 47
Invalid column name 'Current'.
Here is the code below...
--Create Temporaty table to hold dimension records
IF OBJECT_ID('tempdb..#DimVirtualQueue') IS NOT NULL
DROP TABLE #DimVirtualQueue;
CREATE TABLE #DimVirtualQueue
( [VQ_name] [varchar](50) NULL,
[contact_type] [varchar](50) NULL,
[center_node_id] [int] NULL,
[sed_id] [datetime] NULL,
[eed_id] [datetime] NULL,
[insert_date] [datetime] NULL,
[Current] [char](1) NOT NULL
INSERT INTO #DimVirtualQueue(VQ_name, contact_type, center_node_id, sed_id, eed_id, insert_date,[Current] )
SELECT VQ_name, contact_type, center_node_id, sed_id , eed_id,GETDATE(),'Y'
FROM
( --Declare Source and Target tables.
MERGE dbo.tblSwDM_dim_VQ_test AS TARGET
--Source
USING (SELECT
RTRIM(LTRIM(Stage.RESOURCE_NAME)) AS VQ_name,
'Unknown' AS contact_type,
0 AS center_node_id,
CONVERT(INT,CONVERT(VARCHAR(8),GMT_START_TIME,112)) AS sed_id,
CONVERT(INT,CONVERT(VARCHAR(8),ISNULL(GMT_END_TIME,'2070-01-01'),112)) AS eed_id,
GETDATE() AS insert_date
FROM dbo.tblGenesys_stg_RESOURCE_ Stage
WHERE resource_type = 'queue'
AND resource_subtype = 'VirtualQueue'
AND NOT EXISTS (SELECT 1 FROM dbo.tblSwDM_dim_VQ AS dim
WHERE RTRIM(LTRIM(stage.RESOURCE_NAME)) = RTRIM(LTRIM(dim.vq_name))) ) SOURCE
ON TARGET.VQ_name = SOURCE.VQ_name
WHEN NOT MATCHED BY TARGET
THEN
INSERT ( VQ_name, contact_type, center_node_id, sed_id, eed_id, insert_date,[Current] )
VALUES (SOURCE.VQ_name,SOURCE.contact_type,SOURCE.center_node_id,SOURCE.sed_id,SOURCE.eed_id,SOURCE.insert_date,'Y')
WHEN MATCHED AND TARGET.[Current] = 'Y'
AND EXISTS (
SELECT SOURCE.VQ_name
EXCEPT
SELECT TARGET.VQ_name
--Expire the records in target if exist in source.
THEN UPDATE SET TARGET.[Current] = 'N',
TARGET.[eed_id] = SOURCE.eed_id
OUTPUT $Action ActionOut, SOURCE.VQ_name,SOURCE.contact_type,SOURCE.center_node_id,SOURCE.sed_id,SOURCE.eed_id) AS MergeOut
WHERE MergeOut.ActionOut = 'UPDATE';
--Insert data into dimension
INSERT tblSwDM_dim_VQ_test
SELECT VQ_name,contact_type,center_node_id,sed_id,eed_id,insert_date,[Current] FROM #DimVirtualQueue
Any help to resolve issue is appreciated...
Thanks,
Vishal..

You need to show the DDL of your target table: dbo.tblSwDM_dim_VQ_test.
Do you have a column named [Current] in this table?

Similar Messages

  • Error "Error in ABAP statement when processing an internal table. table."

    Hello,
    I am facing the error when tried for GR from SRM portal for my shopping cart and for others created shopping cart. The error is
    "Error in ABAP statement when processing an internal table. table."
    I have the central receipient role. Couold any body assist me?
    Thanks,
    Pijush

    Hi Harish,
    Execute the query in RSRT and check whether you have any short dump is in ST22. This would give a clear idea at what might have gone wrong.
    Another thing is to check whether the code for the variable is fine in the user exit.
    Hope this helps.
    Bye
    Dinesh

  • TS4268 I have apple ID and when trying to sign in to use FaceTime,i always get registration error.how may you help me for that guys,thanks.

    I have apple ID and when trying to sign in to use FaceTime,I always get error in registration,(This words always apper; The server encountered an error processing registration.Please try again later.)
    Can I get your Advise on what to do? Thanks

    Using FaceTime http://support.apple.com/kb/ht4319
    Troubleshooting FaceTime http://support.apple.com/kb/TS3367
    The Complete Guide to FaceTime + iMessage: Setup, Use, and Troubleshooting
    http://tinyurl.com/a7odey8
    Troubleshooting FaceTime and iMessage activation
    http://support.apple.com/kb/TS4268
    iOS: FaceTime is 'Unable to verify email because it is in use'
    http://support.apple.com/kb/TS3510
    Using FaceTime and iMessage behind a firewall
    http://support.apple.com/kb/HT4245
    iOS: About Messages
    http://support.apple.com/kb/HT3529
    Set up iMessage
    http://www.apple.com/ca/ios/messages/
    iOS 6 and OS X Mountain Lion: Link your phone number and Apple ID for use with FaceTime and iMessage
    http://support.apple.com/kb/HT5538
    How to Set Up & Use iMessage on iPhone, iPad, & iPod touch with iOS
    http://osxdaily.com/2011/10/18/set-up-imessage-on-iphone-ipad-ipod-touch-with-io s-5/
    Troubleshooting Messages
    http://support.apple.com/kb/TS2755
    Troubleshooting iMessage Issues: Some Useful Tips You Should Try
    http://www.igeeksblog.com/troubleshooting-imessage-issues/
    Setting Up Multiple iOS Devices for iMessage and Facetime
    http://macmost.com/setting-up-multiple-ios-devices-for-messages-and-facetime.htm l
    FaceTime and iMessage not accepting Apple ID password
    http://www.ilounge.com/index.php/articles/comments/facetime-and-imessage-not-acc epting-apple-id-password/
    Unable to use FaceTime and iMessage with my apple ID
    https://discussions.apple.com/thread/4649373?tstart=90
    FaceTime, Game Center, Messages: Troubleshooting sign in issues
    http://support.apple.com/kb/TS3970
    How to Block Someone on FaceTime
    http://www.ehow.com/how_10033185_block-someone-facetime.html
    My Facetime Doesn't Ring
    https://discussions.apple.com/message/19087457
    To send messages to non-Apple devices, check out the TextFree app https://itunes.apple.com/us/app/text-free-textfree-sms-real/id399355755?mt=8
    How to Send SMS from iPad
    http://www.iskysoft.com/apple-ipad/send-sms-from-ipad.html
    You can check the status of the FaceTime/iMessage servers at this link.
    http://www.apple.com/support/systemstatus/
     Cheers, Tom

  • HT4863 I have an error message coming up when trying to send an email which says 'sending the message failed because you're exceeding the limit' can anyone help me to resolve this please

    I have an error message coming up when trying to send an email which says 'sending the message failed because you're exceeding the limit' can anyone help me to resolve this please

    Try reentering the password in your iCloud mail settings.

  • What does "ajax submit failed: error = 403, forbidden" mean when trying to sign up for eprint?

    what does "ajax submit failed: error = 403, forbidden" mean when trying to sign up for eprint?

    Hi,
    Please use different browser such as Firefox or Chrome and try again.
    Regards.
    BH
    **Click the KUDOS thumb up on the left to say 'Thanks'**
    Make it easier for other people to find solutions by marking a Reply 'Accept as Solution' if it solves your problem.

  • Lost all photos on my iPhoto and get the ERROR WRITING TO DISK when trying to reload from Time Machine. iPhoto cannot import your photos because there was a problem writing to the volume containing your iPHOTO LIBRARY  . Looking for solution.

    Lost all photos on my iPhoto and get the ERROR WRITING TO DISK when trying to reload from Time Machine. iPhoto cannot import your photos because there was a problem writing to the volume containing your iPHOTO LIBRARY  . Looking for solution.

    Problems such as yours are sometimes caused by files that should belong to you but are locked or have wrong permissions. This procedure will check for such files. It makes no changes and therefore will not, in itself, solve your problem.
    First, empty the Trash, if possible.
    Triple-click anywhere in the line below on this page to select it, then copy the selected text to the Clipboard by pressing the key combination command-C:
    find ~ $TMPDIR.. \( -flags +sappnd,schg,uappnd,uchg -o ! -user $UID -o ! -perm -600 \) 2>&- | wc -l | pbcopy
    Launch the built-in Terminal application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Terminal in the icon grid.
    Paste into the Terminal window (command-V). The command may take a noticeable amount of time to run. Wait for a new line ending in a dollar sign ($) to appear.
    The output of the command will be a number. It's automatically copied to the Clipboard. Please paste it into a reply.
    The Terminal window doesn't show the output. Please don't copy anything from there.

  • I am getting an error code of "0" when trying to buy an in app purchase. what is this error?

    i am getting an error code of "0" when trying to buy an in app purchase. what is this error?

    In your first post you wrote
    It is telling me I need 6MB of additional free space
    And in your second post
    Importing to internal hard drive 6.85GB available
    Even assuming that the GB was a typo and should be MB you're still on the hairy edge.

  • FATAL Error...  When trying to remove Apple Mobile Device Support (AMDS).

    FATAL Error... When trying to remove Apple Mobile Device Support (AMDS) on my windows xp. I tried to update iTunes to update my iPhone software and it told me to uninstall iTunes and AMDS for a newer version. Now I get a fatal error and I can't sync my phone. What should I do?

    FATAL Error... When trying to remove Apple Mobile Device Support (AMDS) on my windows xp.
    We've made some progress with some of those in recent days, Stop. It looks like (with some of them), the trouble is caused by trouble with the HKEYCURRENTUSER registry keys associated with your usual XP user account.
    If that's what is afoot, the following technique may be of some assistance.
    Head into your User Accounts control panel and create a new user account with full administrative rights. Log out of your normal account and log into the new account. (Don't use fast user switching to move between accounts.)
    Inside the new account, head into your Add or Remove Programs control panel, and attempt to uninstall AMDS from there.
    Does the uninstall go through without the fatal error in the new user account?
    If so, *staying in the new user account,* do a complete uninstall of iTunes and related componentry as per:
    [Removing and Reinstalling iTunes, QuickTime, and other software components for Windows XP|http://support.apple.com/kb/HT1925]
    (You'll need, in particular, to do the reinstall of iTunes from inside the new account. Experience of the last two cases of this indicates that if you try the reinstall from inside the usual user account, AMDS just silently fails to install.)
    If everything seems to have reinstalled correctly, log out of the new account, and log back into your usual account. Try launching iTunes in your usual account. Does it launch properly in there now?

  • TS3274 Error message 5000 received when trying to update ipad software

    How do I resolve this error message 5000 received when trying to update ipad software from my computer?

    iOS: Resolving update and restore alert messages
    http://support.apple.com/kb/TS1275
    iPad: Unable to update or restore
    http://support.apple.com/kb/ht4097
     Cheers, Tom

  • I have cs4. Had to rebuild my mac OS after malware infected it. Now getting an error code 150:30 when trying to open PS. Can this be fixed or do I have to upgrade to cs6?

    I have cs4. Had to rebuild my mac OS after malware infected it. Now getting an error code 150:30 when trying to open PS. Can this be fixed or do I have to upgrade to cs6?

    150:30 means licensing is broken. It's a common CS4 error. On Macs it usually happens when Photoshop is retrieved from backup or migrated from another Mac. Photoshop is never meant to be moved that way. As advised, you should uninstall and reinstall from your discs.
    Sine reinstall only apply the base install and the CS4 Help > Update function is outdated, you will have to manually download and install your updates from here:  Product updates for Bridge and Photoshop.
    Gene

  • Error message: 50103 (oxffff3c49) when trying to run VILogger

    I get this error message: 50103 (oxffff3c49) when trying to run VI logger for data received from the NI USB 6008 DAQ. What does this mean and how do I fix it?

    Go through all these threads and post back if that solves your problem or still you stuck up.
    Mathan

  • Can't send Email: Error 500 or 403 when trying to use SP.Utilities.Utility.SendEmail

    Hi all,
    I am getting a Internal Server 500 error when trying to send an email using the SP.Utilities.Utility.SendEmail in my SharePoint Online App. It is worth noting that I am working from a custom .aspx page that does not inherit from the Masterpage, and using
    AngularJS (thus the $http).
    If I change the urlTemplate to use the hostWeb instead of the AppWeb, I get a 403 forbidden. Is there a library I need to include since I am using a custom.aspx page instead of the default.aspx page that comes when creating an App?
    Any clues?
     var appweburl = decodeURIComponent(getQueryStringParameter('SPAppWebUrl'));
     var urlTemplate = appweburl + "/_api/SP.Utilities.Utility.SendEmail"; $http({
    contentType: 'application/json',
    url: urlTemplate,
    type: "POST",
    data: JSON.stringify({
    'properties': {
    '__metadata': {
    'type': 'SP.Utilities.EmailProperties'
    'From': [email protected]',
    'To': {
    'results': ['[email protected]']
    'Body': 'Hello',
    'Subject': 'remember'
    headers: {
    "Accept": "application/json;odata=verbose",
    "content-type": "application/json;odata=verbose",
    "X-RequestDigest": $("#__REQUESTDIGEST").val()
    }).success(function(data, status, headers, config) {
    $scope.data = data;
    alert("Email Sent!");
    }).error(function(data, status, headers, config) {
    $scope.status = status;
    alert("Email FAil!");
    Personal Blog: http://thebitsthatbyte.com

    I've got it working in SharePoint Online/SharePoint App using the following. Note that I am using AngularJS:
    function sendEmail() {
    var appweburl = decodeURIComponent(getQueryStringParameter('SPAppWebUrl'));
    var urlTemplate = appweburl + "/_api/SP.Utilities.Utility.SendEmail";
    $http({
    contentType: 'application/json',
    url: urlTemplate,
    method: "POST",
    data: {
    'properties': {
    '__metadata': {
    'type': 'SP.Utilities.EmailProperties'
    'From': '[email protected]',
    'To': {
    'results': ['[email protected]']
    'Body': 'Good Day from the App. Dont reply if this was received.',
    'Subject': 'App says hello and is awaiting your review'
    headers: {
    "Accept": "application/json;odata=verbose",
    "content-type": "application/json;odata=verbose",
    "X-RequestDigest": $("#__REQUESTDIGEST").val()
    }).success(function(data, status, headers, config) {
    console.log("Sent!");
    $location.path('/');
    }).error(function(data, status, headers, config) {
    console.log("fail");
    function getQueryStringParameter(param) {
    var params = document.URL.split("?")[1].split("&");
    var strParams = "";
    for (var i = 0; i < params.length; i = i + 1) {
    var singleParam = params[i].split("=");
    if (singleParam[0] == param) {
    return singleParam[1];
    Personal Blog: http://thebitsthatbyte.com

  • HT201210 My Ipod has an error code of 1604 when trying to restore.  I have followed all recommended instructions...any ideas.??

    My Ipod has an error code of 1604 when trying to restore.  I have followed all recommended instructions...any ideas.??

    If you did all of this
    Error 1604
    This error is often related to USB timing. Try changing USB ports, using a different dock connector to USB cable, and other available USB troubleshooting steps (troubleshooting USB connections. If you are using a dock, bypass it and connect directly to the white Apple USB dock connector cable. If the issue persists on a known-good computer, the device may need service.
    If the issue is not resolved by USB isolation troubleshooting, and another computer is not available, try these steps to resolve the issue:
    Connect the device to iTunes, confirm that the device is in Recovery Mode. If it's not in Recovery Mode, put it into Recovery Mode.
    Restore and wait for the error.
    When prompted, click OK.
    Close and reopen iTunes while the device remains connected.
    The device should now be recognized in Recovery Mode again.
    Try to restore again.
    If the steps above do not resolve the issue, try restoring using a known-good USB cable, computer, and network connection.
    make an appointment at the Genius Bar of an Apple store since it appears you have a hardware problem.
    Apple Retail Store - Genius Bar                       

  • Has anyone received an error code of -3212 when trying to access the Itunes Store?

    Has anyone received an error code of -3212 when trying to access the Itunes Store?

    Just in case, let's try the following document:
    Apple software on Windows: May see performance issues and blank iTunes Store
    (If there's a SpeedBit LSP showing up in Autoruns, it's usually best to just uninstall your SpeedBit Video Accelerator.)

  • I am getting error code 150:30 when trying to open "edit" in PSE 8??

    I am getting error code 150:30 when trying to open "edit" in PSE 8??

    http://helpx.adobe.com/creative-suite/kb/error-licensing-stopped-windows.html

Maybe you are looking for

  • How do I add multiple addresses/contacts in an email tread to my contact list without having to enter each at a time?

    How do I add multiple addresses/contacts in an email tread to my contact list without having to enter each at a time? I have AppleScript but don't see "add address" in any of the boxes/drop-downs. 

  • Clear customize Date field value in workflow using IDOC Script

    hi all I have a customize field type is Date with default value is Current date time. At one step of workflow I want to clear the default value of this field with <$wfUpdateMetaData("xmPublicDate", "")$> But it not effect. The current date time still

  • Why does emac eject tiger DVD?

    I am trying to update my OS from 10.2.8 to Tiger. I have an emac G4 with its original DVD CD-RW/DVD-ROM (vendor: HL-DT-ST). When I click restart to run the installation, before the computer shuts down, it shows "you have inserted a disk containing no

  • About NodeManager

    Hi eveybody Anyone could help me ? .... I'm trying to start a remote server but gets the following error : Starting WebLogic Server .... The WebLogic Server did not start up properly. Exception raised: java.lang.NoClassDefFoundError: java/lang/reflec

  • Why dos my sent box show 140  emails when I have none?

    My iPhone 5 seems to be having an issue with phantom mails, but unlike most of the questions across the forum, this relates to an empty sent box showing 211 emails (but it appears that there are none, and I have deleted all my previously sent message