Help changing all PK and FK datatypes from uniqueidentifier to nvarchar(128)

Is there a simple script to iterate through all my tables and change my PK and FK datatypes to nvarchar(128)? I don't want to have to go through each table manually, remove relationships, and change each key one by one. Here is my db schema if it helps.

Hi Man_Cat,
According to your description, you are looking for the script to update all the PK and FK datatypes from uniqueidentifier to nvarchar(128), right?
Based on my research, we cannot change the data type of the Primary Key and Foreign Key directly as Tom said. However, we can drop the PK and FK and recreate them use the query below.
--This will drop the primary key temporarily
ALTER TABLE MyTable
drop CONSTRAINT PK_MyTable
--change data type
ALTER TABLE MyTable
ALTER COLUMN PrimaryKeyID BigInt
--add primary key
ALTER TABLE MyTable
ADD CONSTRAINT PK_MyTable PRIMARY KEY (PrimaryKeyID)
Reference
http://forums.asp.net/t/1528279.aspx?Alter+script+to+change+the+Primarykey+Column+datatype
Regards,
Charlie Liao
TechNet Community Support

Similar Messages

  • I was in a Pages Doc and inadvertently had the Caps Lock on. How Can I change all the text I typed from Upper Case to Lower Case?

    I was in a Pages Doc and inadvertently had the Caps Lock on. How Can I change all the text I typed from Upper Case to Lower Case?

    Several protocols may be used.
    Here I describe two of them.
    (1) the one which I use : install and use the "Convert to Lowercase" service available in the free WordService
    (2) copy your text, paste in TextEdit and enter the Edit menu.
    I guess that you will recognize the items in your English menu.
    I apologize but I don't know the English items.
    Yvan KOENIG (VALLAURIS, France) jeudi 16 février 2012
    iMac 21”5, i7, 2.8 GHz, 12 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.3
    My Box account  is : http://www.box.com/s/00qnssoyeq2xvc22ra4k

  • I need help importing navigation bars and rollover buttons from fireworks?

    I need help importing navigation bars and rollover buttons from fireworks, drop down menus and rollover states won't work!
    Thanks

    In my experience, the code created by graphics apps is less than satisfactory. And image based menus are very awkward for several reasons. 
    #1 If you decide to change your menu later, you must go back to your graphics app and re-craft the whole thing.  After 2-3 times of this, it gets old in a hurry.
    #2 Image based menus cannot be "seen" by search engines, screen readers and language translators.
    #3 CSS styled text menus are better for your site's visibility, accessibility and they are a snap to edit in Dreamweaver.
    That said, if you're still married to image based menus, use Fireworks to create images only. Use Dreamweaver's Image Rollover Behaviors to create your rollover scripts.
    Nancy O.

  • After downloading Adobe Reader X it changes all my programs to read from Adobe

    Everytime I download Adobe Reader it changes all my programs to open from Adobe Reader: for example - interenet explorers icon is changed to an Adobe icon and it is trying to open up as an Adobe file. I have to unistall the program every time to get my other programs to work. What can I do from preventing this because I used Adobe Reader every day for work and it is a pain to keep installing and unistalling after every use!

    Try this -
    In the Finder's Go menu select Go to Folder.
    Type in /Library/Internet Plug-Ins/ and click Go.
    In the resulting Finder window look for anything with PDF or pdf in the name and drag it to the trash.
    Restart the computer.
    Now try viewing the documents.

  • How to get the values of all elements and sub elements from  following xml

    how to get the values of all elements and sub elements from following xml...
    <?xml version="1.0" encoding="UTF-8" ?>
    <List_AML_Finacle xmlns="http://3i-infotech.com/Cust_AML_Finacle.xsd"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://3i-infotech.com/Cust_AML_Finacle.xsd List_AML_Finacle.xsd">
    <TransactionID>TransactionID</TransactionID>
    <Match>
    <Src_Matched_Field>Src_Matched_Field</Src_Matched_Field>
    <List_Matched_Field>
    <FSFM_Matches>
    <NUMBER>NUMBER</NUMBER>
    <TERROR>TERROR</TERROR>
    <TU>TU</TU>
    <NAMEU>NAMEU</NAMEU>
    <DESCRIPT>DESCRIPT</DESCRIPT>
    <KODCR>KODCR</KODCR>
    <KODCN>KODCN</KODCN>
    <AMR>AMR</AMR>
    <ADDRESS>ADDRESS</ADDRESS>
    <SD>SD</SD>
    <RG>RG</RG>
    <ND>ND</ND>
    <VD>VD</VD>
    <GR>GR</GR>
    <YR>YR</YR>
    <MR>MR</MR>
    <CB_DATE>CB_DATE</CB_DATE>
    <CE_DATE>CE_DATE</CE_DATE>
    <DIRECTOR>DIRECTOR</DIRECTOR>
    <FOUNDER>FOUNDER</FOUNDER>
    <TERRTYPE>TERRTYPE</TERRTYPE>
    </FSFM_Matches>
    <OfacMatchDetails>
    <UID>UID</UID>
    <TITLE>TITLE</TITLE>
    <SDNTYPE>SDNTYPE</SDNTYPE>
    <REMARKS>REMARKS</REMARKS>
    <ID_UID>ID_UID</ID_UID>
    <IDTYPE>IDTYPE</IDTYPE>
    <IDNUMBER>IDNUMBER</IDNUMBER>
    <IDCOUNTRY>IDCOUNTRY</IDCOUNTRY>
    <ISSUEDATE>ISSUEDATE</ISSUEDATE>
    <EXPIRATIONDATE>EXPIRATIONDATE</EXPIRATIONDATE>
    <ADDRESS1>ADDRESS1</ADDRESS1>
    <ADDRESS2>ADDRESS2</ADDRESS2>
    <ADDRESS3>ADDRESS3</ADDRESS3>
    <CITY>CITY</CITY>
    <STATEORPROVINCE>STATEORPROVINCE</STATEORPROVINCE>
    <POSTALCODE>POSTALCODE</POSTALCODE>
    <COUNTRY>COUNTRY</COUNTRY>
    </OfacMatchDetails>
    </List_Matched_Field>
    </Match>
    </List_AML_Finacle>

    avoid multi post
    http://forum.java.sun.com/thread.jspa?threadID=5249519

  • Each song on my iTunes has a duplicate. How do I delete all duplicates and prevent this from happening again in the future?

    Each song on my iTunes has a duplicate. How do I delete all duplicates and prevent this from happening again in the future?

    After I had updated to Itunes 11 (also on Windows 7), I had the same experience, but I suspect that it was because I accepted a proposal to set up an external media library in order to simplify security backups. An associated result was that I had lost all of my playlists!
    What I did was to restore the entire library off my Ipod, using a very good program called PodToPC (a free download is available) selecting an option to replace all of the stuff in the Itunes library. I use the Ipod Classic simply because it has a large capacity to hold my collection of CD and Vinyls. No way was I going to modify duplicates of 10000 tracks in 750 playslists by hand!  I did have a few residual problems with some of the playlist specs but, after a few hours of work all was restored.
    I hope this is useful.

  • HT201274 i tried to erase all content and reset settings from the device option.it is taking too long and its been 15 hours but not yet done.its showing a skeleton sigh with buffering and sometimes flipping to apple sign.

    i tried to erase all content and reset settings from the device option.it is taking too long and its been 15 hours but not yet done.its showing a skeleton sigh with buffering and sometimes flipping to apple sign.

    nabidhadi wrote:
    .its showing a skeleton sigh with buffering and sometimes flipping to apple sign.
    You iPod has been jail broken.  Unfortunately you are on your own here. I can offer that you need to find out which method and software was used to JB.
    Good luck...you're gonna need it....

  • [svn:bz-trunk] 21285: Need to change _parent, privateCall and instance properties from private to protected in order to extend this class for another project

    Revision: 21285
    Revision: 21285
    Author:   [email protected]
    Date:     2011-05-20 07:53:23 -0700 (Fri, 20 May 2011)
    Log Message:
    Need to change _parent, privateCall and instance properties from private to protected in order to extend this class for another project
    Modified Paths:
        blazeds/trunk/apps/ds-console/console/ConsoleManager.as

    Revision: 21285
    Revision: 21285
    Author:   [email protected]
    Date:     2011-05-20 07:53:23 -0700 (Fri, 20 May 2011)
    Log Message:
    Need to change _parent, privateCall and instance properties from private to protected in order to extend this class for another project
    Modified Paths:
        blazeds/trunk/apps/ds-console/console/ConsoleManager.as

  • [svn:osmf:] 14178: PARB changes: Remove unload and query methods from PluginManager.

    Revision: 14178
    Revision: 14178
    Author:   [email protected]
    Date:     2010-02-15 21:35:12 -0800 (Mon, 15 Feb 2010)
    Log Message:
    PARB changes: Remove unload and query methods from PluginManager.  We lack compelling use cases for those methods, but can easily re-add them later if we come across some.
    Modified Paths:
        osmf/trunk/apps/samples/framework/DynamicStreamingSample/src/DynamicStreamingSample.mxml
        osmf/trunk/apps/samples/plugins/AkamaiPluginSample/src/AkamaiPluginSample.mxml
        osmf/trunk/apps/samples/plugins/CaptioningSample/src/CaptioningSample.mxml
        osmf/trunk/framework/OSMF/org/osmf/events/PluginManagerEvent.as
        osmf/trunk/framework/OSMF/org/osmf/plugin/PluginManager.as
        osmf/trunk/framework/OSMFIntegrationTest/org/osmf/plugin/TestPluginManagerIntegration.as
        osmf/trunk/framework/OSMFTest/org/osmf/plugin/TestPluginManager.as
        osmf/trunk/plugins/CaptioningPluginTest/src/CaptioningPluginTest.mxml

  • I am ordering a new IPad 4 and I now own an Original IPad.  Can I transfer all settings and info. direct from old to new?

    I am ordering a new IPad 4 and I now own an Original IPad.  Can I transfer all settings and info. direct from old to new?  How?

    Yes, restore the iPad usind a backup file created in iTunes from the iPad 1.

  • 3gs no service after updating to ios 5 tried network reset, reset all settings and even restoring from back been with out phone for 3 weeks now need help telus cant find network problem and apple has bad customer support please help!!!

    my 3gs has no service after updating from ios 5 tried resetting network settings, resetting all settings and restoring from back up on itunes.
    telus cant find any network problems and apple is difficult to deal with.please help 3 weeks with no phone and $70 a month not happy.

    I have been having a similar problem for the last few days.Without warning the signal will just completely duck out leaving the device searching for several minutes before settling on a no signal message.
    Sometimes restarting the device, toggling data and 3g settings or toggling Airplane Mode will set things right. However, a lot of the time I've been left without a working phone.
    I don't believe this is a SIM issue, as I had to change my SIM only one month ago for another signal related problem. Again any help would be appreciated here as well.

  • Hi, I need information about to change mi addrees and credit card from USA to Spain. Any ones  can help me?. Thank you

    Hi,
    I did my suscription two years ago living in Florida. Now I moved to Spain and I need to change my addreess and my credit card to continue with my Adobe Icloud suscription. Any one can help me? Thank you

    Some Change/Verify Account links https://forums.adobe.com/thread/1465499 that may help
    -Credit card https://helpx.adobe.com/x-productkb/policy-pricing/membership-subscription-troubleshooting -creative-cloud.html
    -http://helpx.adobe.com/x-productkb/policy-pricing/change-country-associated-with-adobe-id. html

  • Want to change ALL photos in finished project from 'Tint' to 'Color Tint'

    Is there an easier way to change all photos that have a 'tint' effect to another effect without having to manually go into each image?
    I have a nearly finished 90 min doc that has a plethera of stills that I have added a 'Tint' from Image Control effect. However I have found that in many of my dissolves there seems to be some green frames thrown in the mix, (ONLY within the dissolve?) Anyhow, I found a work-around:
    By changing the original tint effect from dropdown----Effects; Video Filters; Image Control; Tint
    to
    Effects; Video Filters; Quicktime; Color Tint.
    For whatever reason, this corrects my random 'green frame' action.
    So does anyone know if there is some kind of batch edit that I can do, that recognizes all the images w/ Tint and change it to Color Tint in felt swoop?
    If not in FCP 5.1.2, maybe in 6?
    Thanks,
    Zack

    hi,
    boring but you can add the effect to the first still. Then apple -C it. Then select all the clips you want to change (apple-click will select no contigous clips) then select Remove Attributes from the edit menu. Select the Filters checkbox. Then select Paste Attributes from the edit menu. Select filters again and you're done.
    hope this helps
    adam

  • Search script generator for all objects and data (!) from a user/schema ?

    Is there a way to create a script which (when run) creates all the existing
    TABLES; INDEXES, KEYS and DATA for a specified user/schema ?
    This (PL-)SQL script should contain all INSERTS for the currently existing rows of
    all the TABLEs.
    When I use e.g. export to Dumpfile I have at first find all TABLEs and components
    which I want to dump. This is rather uncomfortable.
    I just want to specify the user name similar to
    createscript user=karl@XE outfile=D:\mydata\myscript.sql
    Is this somehow possible ?

    So that I understand your requirements exactly, are you asking for your script to ...
    1/ export from database A the entire schema of a specified user
    2/ drop all objects owned by that user in database B
    3/ import the objects from database A into database B
    If so, it sounds to me that a shell script that does a schema level export as Nicholas suggested, and then drops the user from database B using the cascade keyword (e.g. drop user username cascade), recreates the user and then imports the export file into B should do the trick.
    I don't think searching for individual tables and creating the statements to recreate them is the best idea.
    Hope that helps
    Graham

  • How to remove all in and out points from extendscript code?

    Hi,
         I am creating a sequence from a clip from extendscript code to automateToSequence function.
         But if there are some in and out points in the clip only the select clip part is converted as a sequence, what is the solution to remove all those in and out points from extendscript code, or to get the full clip to sequence even there are some in and out points.
    I am using the function like this; qe.project.getItemAt(i).automateToSequence(seq,0,0,1,1);
    Please suggest,
    Thanks and Regards,
    Anoop NR

    Double click the pre-comp or nested comp, open comp settings from the menu or by using the keyboard shortcut Ctrl/Cmnd + k.
    Note, changing the length of the comp will not extent the length of footage or layers inside the comp. You have to do that manually and it depends on your footage type.

Maybe you are looking for

  • Multiple Choice Quiz issues

    Hello I just build a multiple choice quiz using Captivate 3. The quiz have3 right answers. I set it up so that the user has infinite number of attempts. However after the first try I can try the quiz again. Has anyone experienced this problem. If it'

  • How to load local html-file into webBrowser tool? [SDK 6.5]

    The webbroser tool lets you load an external html by inputting the adress in its "Url"-property. But how do you load a local html-file that is added to your project? Lets say the path is: Folder1/Subfolder1/Webpage1.html. What would I put in the Url-

  • BI Administration - Synchronize with Database Table

    Hi, I have added 2 new columns in the Database and I want to synchronize them with the Physical Layer in BI Model. How can I do this without affecting any relationships? Thanks

  • Attachment jpg

    Hi,  I used the SMPT Send File.vi to send an E-mail with an attachment which is a picture,  picture format is .JPG. But in the foxmail I can't open it. I want know the reason and how can I get the picture from E-mail. Thanks in  advance.

  • How can I physically change external HDs, without losing file pathways?

    I hope this makes sense to you guys... I posted this on a non-computer forum, got no real help, so here we are... Macbook with 2 external harddrives for files... One is a backup... I have two external hard-drives. Well, 3, but two for the point of th