Migrating legacy code to 2008 R2 standards...

Hi , I'm trying to rewrite the below code which uses tmp tables developed in 2000 version of SQL to 2008 R2 .any help in tuning query is appreciated.. -- Load all ip_id and skill combinations from tblSwDM_stg_SYNONYM into #temp_Complete_Skill_List
INSERT #temp_Complete_Skill_List
SELECT DISTINCT sm.switch_id, s.value, max(s.item_name), max(s.descr)
FROM tblSwDM_stg_SYNONYM s (NOLOCK)
INNER JOIN tblSwDM_SwitchMaster sm (NOLOCK)
ON s.cms_id = sm.cms_id
AND s.acd_no = sm.acd_number
WHERE s.item_type = 'split'
GROUP BY sm.switch_id, s.value
-- Append all additional ip_id and skill combinations from tblSwDM_stg_DSPLIT_UNIQUE into #temp_Complete_Skill_List
INSERT #temp_Complete_Skill_List
SELECT DISTINCT stg.ip_id, stg.split, NULL, NULL
FROM tblSwDM_stg_DSPLIT_UNIQUE stg (NOLOCK)
LEFT OUTER JOIN #temp_Complete_Skill_List tmp
ON stg.ip_id = tmp.switch_id
AND stg.split = tmp.skill
WHERE tmp.switch_id IS NULL
AND tmp.skill IS NULL
---- The above code will be later used to load the table below..
UPDATE tblSwDM_Dictionary
SET end_effective_date = @end_effective_date
FROM tblSwDM_Dictionary
INNER JOIN #temp_Updated_Skill ON tblSwDM_Dictionary.row_id = #temp_Updated_Skill.row_id
WHERE tblSwDM_Dictionary.end_effective_date IS NULL
INSERT INTO tblSwDM_Dictionary ([dictionary_type_id], [switch_id], [value], [name], [description], [start_effective_date])
SELECT DISTINCT dictionary_type_id, switch_id, skill, NULLIF(skill_name, ''), NULLIF(skill_description, ''), @start_effective_date
FROM #temp_Updated_Skill
Thank you ,
vishal.

>> I'm trying to rewrite the below code which uses TMP tables developed in 2000 version of SQL to 2008 R2<<
How much can you do to upgrade the schema? You have a ton of ISO-111798 violations in the data element names. For example, the prefix “tbl-' is absurdly redundant and it is called “tbling” as a design flaw.
We do not use temp tables in good SQL. This is how an old COBOL programmer fakes using a scratch tape instead of using a derived table, VIEW or CTE. You even do a step-by-step tape merge in SQL! 
DISTINCT and GROUP BY are seldom used together. But we have no DDL or other specs, so we do not know. The correct form is INSERT INTO; INSERT is dialect.
The use of NULLIF(skill_name, '') and NULL constant columns is usually a sign of bad design. How can the skill name be an empty string in a valid schema? Where is the explicit “unknown” value? Why create NULLs and then overwrite them in another process step?
(answer: This is how we did data processing with punch cards in the 1960's!)
The term “master” is not RDBMS; it is from tape files and network databases. 
Why do you have multiple names for the same data element? What is the generic, vague “value”? Generic vague “skill” (skill_name, skill_level, skill_code, etc), “split”? Likewise, there is no such thing as a “type_id” in RDBMS. Do you have a “blood_type” or
a “blood_type_id”? See the redundancy? People actually will say “blood_type_id_value” or worse. 
Did you know that the 1970's Sybase UPDATE..FROM.. does not work or port? Today we might use a MERGE statement. 
But my preference would be a 
CREATE VIEW Complete_Skill_List (switch_id, something_value, item_name, something_description)
so that it is always correct and current. It will also probably be faster than constantly doing disk seeks and updates. 
Any help?
--CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
in Sets / Trees and Hierarchies in SQL

Similar Messages

  • Discovering the Design Behind Legacy Code

    Hi all,
    There are lots of tools and utilities out there to help us design good code, and lots of design patterns and good methodologies for us to follow. However, when you're looking at legacy code, is there any "standard" way of trying to work out what's going on?
    At the moment I'm just going through each class as it is called and trying to work out what it does and what it depends on - but this is really time consuming (not to mention tedious).
    Does anyone know of a better way?

    Do you have a UML tool that will allow you to build a model of the code, and then use that model to generate additional views?
    � {�                                                                                                                                                                                                                                                                       

  • Downgrade SQL 2008 R2 Enterprise Cluster to SQL 2008 R2 Standard Cluster

    Hi
    While I found several information about Downgrading an 2008 R2 Enterprise to 2008 R2 Standard edition (even here in this forum) I didn't found much information doing this when it's a clustered SQL Server. Is there anything I've to be aware of? My solution
    I've in mind is:
    1.) Stop SQL Service
    2.) Move all database (users and system) to another location
    3.) Uninstall existing Enterprise nodes/instances of both servers
    4.) Install the SQL 2008 R2 Standard on both nodes. Use same folders for databases as in the original installation. Use also all other configs as the original one (instance/cluster name, network ressource name,...)
    5.) Stop SQL Service
    6.) Remove original user and system databases back to their original folder. Replace system databases of new installation with the original ones.
    Should this work or not?

    Hi,
    I guess you already know it and you are follwoing correct process.But what plans you have for  enterprise features which were used in Ent edition and will not be present in standard edition.did you made any alternatives for it.
    Did you checked your application code or built in jobs(which used enterprise features) if so good to go then.
    For features suported by various edition look at below link
    http://msdn.microsoft.com/en-us/library/cc645993(v=sql.105).aspx
    For downgrading this link will be helpful
    http://www.mssqltips.com/sqlservertip/3079/downgrade-from-sql-server-enterprise-edition-to-standard-edition/
    Please make sure you migrate login and jobs either with script method or use below link
    http://support.microsoft.com/kb/918992/en-gb
    Please mark this reply as the answer or vote as helpful, as appropriate, to make it useful for other readers

  • Unable to install SQL server 2008 r2 standard edition on windows server 2008 r2 sp1

    I am unable to install sql server 2008 r2 standard edition on windows server 2008 r2 sp1.
     On the Setup Support Files page, choose Install this step I don't get any other window i.e. nothing happens I waited for 5-10 min.  Then I checked the log file.
    Final result:                  Failed: see details below
      Exit code (Decimal):           -2068053929
      Exit facility code:            1212
      Exit error code:               87
      Exit message:                  Failed: see details below
      Start time:                    2014-03-18 14:59:31
      End time:                      2014-03-18 15:00:25
    === Verbose logging started: 3/19/2014  9:45:47  Build type: SHIP UNICODE 5.00.7601.00  Calling process: E:\SQL Server 2008 R2 Standard\x64\setup100.exe ===
    MSI (c) (10:34) [09:45:47:496]: Note: 1: 2203 2: E:\SQL Server 2008 R2 Standard\x64\redist\watson\dw20sharedamd64.msi 3: -2147287038
    MSI (c) (10:34) [09:45:47:496]: MsiOpenPackageEx is returning 2.
    === Verbose logging stopped: 3/19/2014  9:45:47 ===
    Please help As i am running out of time as i have to upgrade TFS for that first step is to install SQL server.

    Hello,
    The following are a few things you can try:
    Copy the media to the local disk drive, unzip it (in case you are installing from an ISO file, and run SQL Server setup from there.
    Try to unregister and register the Windows Installer with the following two commands:
    msiexec /unregister
    msiexec /regserver
    Try to use Process Monitor to log the detailed error produced when the installation of dw20sharedamd64.msi fails. You can download Process Monitor from the following link:
    http://technet.microsoft.com/en-us/sysinternals/bb896645
    Share with us the error captured by Process Monitor.
    Hope this helps.
    Regards,
    Alberto Morillo
    SQLCoffee.com

  • Cannot install WINS Server Role on Windows Server 2008 R2 Standard x64

    Hi, 
    We are trying to install WINS Server Feature on a brand new Windows Server 2008 R2 Standard x64 (Virtual Machine). It seems that WINS is getting installed and right at the very end it gives an error 0x80070002.
    We have tried rebooting the server multiple times , DNS/DHCP roles have been installed successfully as
    well . It is just the WINS server feature that we are unable to install on this server. 
    Can someone point us to right direction. Are there any pre requisites we need to ensure before installing this feature. Are there any alternate ways to install
    the WINS feature .. if yes please let us know. 

    The error indicates a File was not found:
    C:\Users\Mark\Documents\Tools>err 0x80070002
    # for hex 0x80070002 / decimal -2147024894
      COR_E_FILENOTFOUND                                            
    corerror.h
    # MessageText:
      DIERR_NOTFOUND                                                
    dinput.h
      DIERR_OBJECTNOTFOUND                                          
    dinput.h
      STIERR_OBJECTNOTFOUND                                         
    stierr.h
    # as an HRESULT: Severity: FAILURE (1), FACILITY_WIN32 (0x7), Code 0x2
    # for hex 0x2 / decimal 2
      ERROR_FILE_NOT_FOUND                                          
    winerror.h
    # The system cannot find the file specified.
    # 5 matches found for "0x80070002"
    I would check a few things:
    1) Is the OS activated (Control Panel/System)
    2) Is the OS fully patched and has it been rebooted since it was patched?

  • Want to Buy SQL 2008/2012 standard edition to achieve Database failover

    Hi Team,
    We want to know exact part code details to procure 2 nos Sql 2008/2012 standard edition server to installed on "Window 2012 R2 Standard Edition, Factory installed, no media, 2 socket,2 VMs, No client" Server.
    I have Access control system application (Main-Standby) on which we need Automatic database failover by using SQL Standard server. Application vendor has suggested us to procure 2 nos of Microsoft Sql 2008/2012 standard edition server.
    If possible then please let me know exact part code details of Sql 2008 and 2012 standard edition server which doesn't have any issue to installed on above said server edition.
    Thanks,
    Vishal

    Hi Vishal,
    Unfortunately, we do not deal with part codes, I request you to check the below link as this is not the correct forum.
    http://www.microsoft.com/en-in/server-cloud/products/sql-server/Support.aspx
    Perhaps you could post you question on the SQL forum :
    https://social.msdn.microsoft.com/Forums/sqlserver/en-US/home?category=sqlserver
    Regards,
    Mekh.

  • Tdx.sys ntkrnlmp.exe BSOD after P2V Windows 2008 R2 Standard

    Hi all,
    We ran a P2V against a Server 2008 R2 Standard (SBS) DC on the weekend. Given that VMware hasn't released a cold clone ISO for a while, we used ShadowProtect Recovery Environment and Hardware Independent Restore. It worked a treat, stripped the old physical
    NICs out.
    Monday morning it threw a BSOD, then again at 10 am that day.
    We immediately patched to remove the http.sys BSOD vulnerability to be safe.
    We also patched 2008 R2 to SP1 x64 latest versions.
    It crashed again last night, then again at 10 am today and every day since.
    The BSOD dumps mention ntkrnlmp.exe and tdx.sys
    vSphere is a new Intel server S2600CP2 running vSphere 5.5 Update 2.
    The VM is running a VMXnet3 NIC, we've had issues before. RAID controller is Intel RMS25PB040.
    The server runs AD/DNS, Exchange, File Shares and Printers.
    We're combing through tasks, as it may be falling over at the same time every couple of days.
    We've disabled Kaspersky Endpoint protection.
    We will be planning to swap over the VMXnet3 NIC to E1000 later today, once we have a full backup that runs to USB.
    After extensive researching we are leaning towards the NIC/network being a problem under load causing the BSOD.
    Anyone else have any other suggestions we can try to resolve the BSOD issues?
    Screenshot of the BSOD error codes: http://imgur.com/xRwZcKf
    Here is an output of the minidump file:
    Debugging Details:
    TRIAGER: Could not open triage file : e:\dump_analysis\program\triage\modclass.ini, error 2
    BUGCHECK_STR:  0x7f_8
    CUSTOMER_CRASH_COUNT:  1
    DEFAULT_BUCKET_ID:  WIN7_DRIVER_FAULT_SERVER
    PROCESS_NAME:  System
    CURRENT_IRQL:  2
    LAST_CONTROL_TRANSFER:  from fffff80001e911a9 to fffff80001e91c00
    STACK_TEXT:
    fffff80001d22d28 fffff80001e911a9 : 000000000000007f 0000000000000008 0000000080050031 00000000000406f8 : nt!KeBugCheckEx fffff80001d22d30 fffff80001e8f672 : 0000000000000000 0000000000000000
    0000000000000000 0000000000000000 : nt!KiBugCheckDispatch+0x69 fffff80001d22e70 fffff88003413a0c : 0000000000000000 0000000000000000 0000000000000000 0000000000000000 : nt!KiDoubleFaultAbort+0xb2
    fffff88002b02f90 0000000000000000 : 0000000000000000 0000000000000000 0000000000000000 0000000000000000 : tdx!TdxIssueQueryAddressRequest+0x5c
    STACK_COMMAND:  kb
    FOLLOWUP_IP:  tdx!TdxIssueQueryAddressRequest+5c fffff88003413a0c ff1576370100    call    qword ptr [tdx!_imp_ExAllocatePoolWithTag (fffff88003427188)]
    SYMBOL_STACK_INDEX:  3
    SYMBOL_NAME:  tdx!TdxIssueQueryAddressRequest+5c
    FOLLOWUP_NAME:  MachineOwner
    MODULE_NAME: tdx
    IMAGE_NAME:  tdx.sys
    DEBUG_FLR_IMAGE_TIMESTAMP:  4ce79332
    FAILURE_BUCKET_ID:  X64_0x7f_8_tdx!TdxIssueQueryAddressRequest+5c
    BUCKET_ID:  X64_0x7f_8_tdx!TdxIssueQueryAddressRequest+5c
    Followup: MachineOwner

    Hi Sir,
    >>We ran a P2V against a Server 2008 R2 Standard (SBS) DC on the weekend. Given that VMware hasn't released a cold clone ISO for a while
    It seems that you have performed WMware P2V , it is beyond what we can support . You may need to post this issue into WMware forum :
    https://communities.vmware.com/welcome
    In windows hyper-v , there is a tool " disk2VHD" can help us to perform P2V :
    https://technet.microsoft.com/en-us/library/ee656415.aspx?f=255&MSPPError=-2147217396
    Best Regards,
    Elton Ji
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected] .

  • How to migrate source code from TFS 2010 to a new TFS 2010

    Hi,
    Please help me, How to migrate source code from TFS 2010 to a new TFS 2010. we are using SQL 2008 R2 for DB storage and we have Backup of TFS DB. First TFS 2010 is live environment and second TFS 2010 is test environment both OS and SQL version is same. 

    Hi Pankaj0439,
    In general, to move TFS from a hardware to another, you can follow the steps as below:
    1. Check your permissions
    2. Back up databases and install software
    3. Restore TFS databases to the new hardware
    4. Update the configuration of the new application-tier server
    5. Verify permissions, notify users, and configure backups
    And you can also refer to this
    article in MSDN for more details.
    Best regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Which version of Windows Server 2012 needs to be ordered so that I can downgrade to Windows Server 2008 64bit Standard SP2

    Dears in Microsoft,
    We need to have Windows Server 2008 Standard SP2 64bit to be installed and due to the fact it is no more available in Microsoft.
    I am going to order Windows 2012 with 16 CAL in order to downgrade it to Windows 2008 Standard SP2 64bit. My question is:
    1. Which version of Windows Server 2012 needs to be ordered so that I can downgrade to Windows Server 2008 64bit Standard SP2?
    2. what else required in terms of product key, media, license...etc?
    Appreciate your kind supports.
    thanks and best regards
    Barznj Abdullah

    Any licensing questions are always best addressed by a trained Microsoft licensing specialist.  You can find whom to call by looking at www.microsoft.com/licensing.
    One of the built-in rights of a Windows Server license is the right to run earlier versions of the operating system.  So if you purchase either Standard or Datacenter, you can run 2008 Standard.
    However, that does not provide the media or activation codes for earlier versions of the operating sytem.  You have to obtain those via other channels.  You should most likely contact a Microsoft reseller and talk to them.  They will
    most likely have a trained licensing specialist on hand to help answer your questions, and they should also be able to provide media for earlier distributions (for a slight fee).
    .:|:.:|:. tim

  • Migrate Legacy Collectors

    Hello ,
    is there a guide how to migrate Legacy collectors to JavaScript
    Collectors ?
    I found this :
    Code:
    Writing Javascript Collectors
    NetIQ provides a comprehensive, Eclipse-based software development kit (SDK) that will help you migrate legacy Collectors to Javascript Collectors. This SDK can be accessed from the Sentinel developer portal at http://www.novell.com/developer/deve..._sentinel.html. A guide for migrating a legacy Collector to the JavaScript framework will be made available soon on this site as well.
    If your organization requires additional assistance, NetIQ and our trusted Partners offer customized IT Consulting services in order to ease your transition to the Javascript Collector framework. Our experienced staff can help you to write JavaScript Collectors or provide staff augmentation and expertise. If you need assistance with moving to the JavaScript Collector framework, please contact NetIQ Consulting for more information.
    If you have any questions or concerns, please contact NetIQ support or your NetIQ sales representative.
    CIURI86
    CIURI86's Profile: https://forums.netiq.com/member.php?userid=5735
    View this thread: https://forums.netiq.com/showthread.php?t=51937

    Hi,
    As far as I know there are no guides.
    The best you can do is take the equivalent sentinel 7 collector and see
    if it fits your need maybe enhancing it a bit with a custom.js (see the
    documentation on how to do that).
    You can also take the code from the legacy collector and create your own
    java collector (with the SDK). I have done this in the most cases and
    found it is relatively easy but it will take some time to write and test
    your collector.
    Hope this helps,
    Anco
    jcvader1
    jcvader1's Profile: https://forums.netiq.com/member.php?userid=502
    View this thread: https://forums.netiq.com/showthread.php?t=51937

  • How to install Cisco Work 3.2 on Windows 2008 Server Standard R2

    Hi Everyone,
    I have got Cisco Works LAN Management 3.2. But the problem is that i have a Windows 2008 Server Standard R2 and when i try to install, it fails. What I read from the below link is that it supports
    "Windows 2008 Server Standard and Enterprise Edition with Service Pack 1 and 2. Both 32-bit and 64-bit operating systems are supported on the above versions."
    http://www.cisco.com/en/US/partner/prod/collateral/netmgtsw/ps6504/ps6528/ps2425/data_sheet_c78-534877.html
    Please help me out on how i should install on the Windows 2008 Server Standard R2. If there is any patch or any other way out.
    Awaiting your response.
    Farid

    Hi ,
    LMS 3.2 is not supported on Windows 2008 Server Standard R2.
    here is the supported platoform for LMS 3.2
    http://www.cisco.com/en/US/docs/net_mgmt/ciscoworks_lan_management_solution/3.2/install/guide1/prereq.html#wp1110367
    Thanks,
    Gaganjeet

  • How to install SQL server 2008 express on Windows server 2008 R2 standard OS

    Hi,
    I have Windows server 2008 R2 Standard edition (64-bit) and trying to install SQL server 2008 express edition since I do not have SQL server 2008. When I install it I am unable to see Management Studio so I am trying to install management studio as well
    but still I am facing issue. Please let me know whether SQL server 2008 express edition is compatible with  Windows server 2008 R2 Standard. If not then pls let me know the proper steps to install it.
    Regds

    Hello,
    Service Pack 1 for SQL Server 2008 is required to be compatible with Windows Server 2008 R2.
    Please download QL Server 2008 Express with SP1 included from the following link:
    http://www.microsoft.com/en-us/download/details.aspx?id=25052
    Hope this helps.
    Regards,
    Alberto Morillo
    SQLCoffee.com

  • Unit testing legacy code - best approach?

    Hi,
    I've got a project full of legacy code (by this I simply mean untested) and I'm experimenting with retrofitting unit testing to it. I'm sure this entails a great many problems, but here's the first one.
    We have a central class with the Singleton pattern - it's instantiated once and then fetched all over the code. It's a concrete class at the moment, not an interface. Let's call this CentralControl.
    Because the code I want to test relies on the presence of this class, and yet it's too complex/heavyweight to properly instantiate in a test scenario, I need to mock it.
    I guess the ideal way is to turn what's now CentralControl into an interface, and have both a real and mock implementation. The code that enforces the singleton behaviour could have a new method to instantiate the mock version rather than the real thing.
    Would you do this yourself rather than alternatives like extending it, and are there any tools to help automate the process?
    Thanks,
    Rob

    I guess the ideal way is to turn what's now CentralControl into an interface...I think that's the better idea, but you can mock classes as well as interfaces; e.g., EasyMock 2.2.2 and higher.
    ~

  • Windows server 2008 R2 Standard Edition

    Dear Team,
    I am having server 2008 R2 standard edition. The Server is getting shut down and showing error in event viewer
    "Windows Kernel event ID 41 error "The system has rebooted without cleanly shutting down first"
    Please reply on this asap to resolve the issue.

    Hi,
    unfortunately it is impossible to trace the cause if an improper shutdown from just the event (title).
    Check this related kb article:
    http://support.microsoft.com/kb/2028504
    Please post back if you need further assistance in troubleshooting or consider opening a support case with Microsoft in case you want Microsoft to fix this for you.
    MCP/MCSA/MCTS/MCITP

  • Web Service Client(Console App) not working on Windows Server 2008 R2 Standard Edition

    I am trying to consume an ASMX Web Service in a console app, its working fine in Windows 7,Windows Server 2012 Standard,Windows Server 2008 R2 DataCenter,Windows Server 2008 R2 Enterprise, But its not working in Windows Server 2008 R2 Standard Edition which
    is the deployment server.
    I tried consuming the ASMX web service using Web Reference and Service Reference as well but its not helping. Its throwing up the following error,
    Message:There is an error in XML document (1, 331491).
    Inner Exception : System.Xml.XmlException: '.', hexadecimal value 0x00, is an invalid character. Line 1, position 331491.
    The scenario is that i call the web service and it returns me an XML i am not able to receive the XML on Windows Server 2008 R2 Standard Edition.
    Please provide suggestions on this I need to resolve this ASAP.

    Hi,
    This question is better asked here:
    http://social.msdn.microsoft.com/Forums/en-US/home?forum=asmxandxml
    Experts here are more familiar about it and they can give you more efficient suggestion.
    Thank you.

Maybe you are looking for