[{"data":1,"prerenderedAt":513},["ShallowReactive",2],{"article-rename-sql-server-schema":3},{"article":4,"tags":317,"previous":332,"next":435},{"id":5,"title":6,"author":7,"body":8,"createdAt":307,"description":308,"extension":309,"img":310,"meta":311,"navigation":47,"path":312,"seo":313,"stem":314,"tags":315,"updatedAt":307,"__hash__":316},"articles\u002Farticles\u002Frename-sql-server-schema.md","Rename SQL Server Schema","[object Object]",{"type":9,"value":10,"toc":305},"minimark",[11,15,18,301],[12,13,14],"p",{},"Copying SQL Databases, renaming is not as easy as it could be.  Luckily the following script can make the effort much easier.  Give it a try.",[12,16,17],{},"After copying a SQL Server database I needed to create a new schema and transfer all tables and views and stored procedures\nfrom the old schema to the newly created schema.  Using the following script made this task much easier.",[19,20,25],"pre",{"className":21,"code":22,"language":23,"meta":24,"style":24},"language-sql shiki shiki-themes github-light github-dark","DECLARE @OldSchema AS varchar(255)\nDECLARE @NewSchema AS varchar(255)\n\nSET @OldSchema = 'dbo'\nSET @NewSchema = 'StackOverflow'\n\nDECLARE @sql AS varchar(MAX)\n\nDECLARE @Schema AS varchar(MAX)\nDECLARE @Obj AS varchar(MAX)\n\n-- First transfer Tables and Views\n\nDECLARE CU_OBJS CURSOR FOR\nSELECT TABLE_SCHEMA, TABLE_NAME\nFROM INFORMATION_SCHEMA.TABLES\nWHERE TABLE_SCHEMA = @OldSchema\n\nOPEN CU_OBJS\n\nFETCH NEXT FROM CU_OBJS\nINTO @Schema, @Obj\n\nWHILE @@FETCH_STATUS = 0\nBEGIN\nSELECT @sql = 'ALTER SCHEMA [' + @NewSchema + '] TRANSFER [' + @OldSchema + '].[' + @Obj + ']'\nPRINT @sql\n--  EXEC (@sql)\n\n    FETCH NEXT FROM CU_OBJS\n    INTO @Schema, @Obj\nEND\n\nCLOSE CU_OBJS\nDEALLOCATE CU_OBJS\n\n\n-- Now transfer Stored Procedures\n\nDECLARE CU_OBJS CURSOR FOR\nSELECT sys.schemas.name, sys.procedures.name\nFROM sys.procedures,sys.schemas\nWHERE sys.procedures.schema_id=sys.schemas.schema_id and sys.schemas.name = @OldSchema\n\nOPEN CU_OBJS\n\nFETCH NEXT FROM CU_OBJS\nINTO @Schema, @Obj\n","sql","",[26,27,28,36,42,49,55,61,66,72,77,83,89,94,100,105,111,117,123,129,134,140,145,151,157,162,168,174,180,186,192,197,203,209,215,220,226,232,237,242,248,253,258,264,270,276,281,286,291,296],"code",{"__ignoreMap":24},[29,30,33],"span",{"class":31,"line":32},"line",1,[29,34,35],{},"DECLARE @OldSchema AS varchar(255)\n",[29,37,39],{"class":31,"line":38},2,[29,40,41],{},"DECLARE @NewSchema AS varchar(255)\n",[29,43,45],{"class":31,"line":44},3,[29,46,48],{"emptyLinePlaceholder":47},true,"\n",[29,50,52],{"class":31,"line":51},4,[29,53,54],{},"SET @OldSchema = 'dbo'\n",[29,56,58],{"class":31,"line":57},5,[29,59,60],{},"SET @NewSchema = 'StackOverflow'\n",[29,62,64],{"class":31,"line":63},6,[29,65,48],{"emptyLinePlaceholder":47},[29,67,69],{"class":31,"line":68},7,[29,70,71],{},"DECLARE @sql AS varchar(MAX)\n",[29,73,75],{"class":31,"line":74},8,[29,76,48],{"emptyLinePlaceholder":47},[29,78,80],{"class":31,"line":79},9,[29,81,82],{},"DECLARE @Schema AS varchar(MAX)\n",[29,84,86],{"class":31,"line":85},10,[29,87,88],{},"DECLARE @Obj AS varchar(MAX)\n",[29,90,92],{"class":31,"line":91},11,[29,93,48],{"emptyLinePlaceholder":47},[29,95,97],{"class":31,"line":96},12,[29,98,99],{},"-- First transfer Tables and Views\n",[29,101,103],{"class":31,"line":102},13,[29,104,48],{"emptyLinePlaceholder":47},[29,106,108],{"class":31,"line":107},14,[29,109,110],{},"DECLARE CU_OBJS CURSOR FOR\n",[29,112,114],{"class":31,"line":113},15,[29,115,116],{},"SELECT TABLE_SCHEMA, TABLE_NAME\n",[29,118,120],{"class":31,"line":119},16,[29,121,122],{},"FROM INFORMATION_SCHEMA.TABLES\n",[29,124,126],{"class":31,"line":125},17,[29,127,128],{},"WHERE TABLE_SCHEMA = @OldSchema\n",[29,130,132],{"class":31,"line":131},18,[29,133,48],{"emptyLinePlaceholder":47},[29,135,137],{"class":31,"line":136},19,[29,138,139],{},"OPEN CU_OBJS\n",[29,141,143],{"class":31,"line":142},20,[29,144,48],{"emptyLinePlaceholder":47},[29,146,148],{"class":31,"line":147},21,[29,149,150],{},"FETCH NEXT FROM CU_OBJS\n",[29,152,154],{"class":31,"line":153},22,[29,155,156],{},"INTO @Schema, @Obj\n",[29,158,160],{"class":31,"line":159},23,[29,161,48],{"emptyLinePlaceholder":47},[29,163,165],{"class":31,"line":164},24,[29,166,167],{},"WHILE @@FETCH_STATUS = 0\n",[29,169,171],{"class":31,"line":170},25,[29,172,173],{},"BEGIN\n",[29,175,177],{"class":31,"line":176},26,[29,178,179],{},"SELECT @sql = 'ALTER SCHEMA [' + @NewSchema + '] TRANSFER [' + @OldSchema + '].[' + @Obj + ']'\n",[29,181,183],{"class":31,"line":182},27,[29,184,185],{},"PRINT @sql\n",[29,187,189],{"class":31,"line":188},28,[29,190,191],{},"--  EXEC (@sql)\n",[29,193,195],{"class":31,"line":194},29,[29,196,48],{"emptyLinePlaceholder":47},[29,198,200],{"class":31,"line":199},30,[29,201,202],{},"    FETCH NEXT FROM CU_OBJS\n",[29,204,206],{"class":31,"line":205},31,[29,207,208],{},"    INTO @Schema, @Obj\n",[29,210,212],{"class":31,"line":211},32,[29,213,214],{},"END\n",[29,216,218],{"class":31,"line":217},33,[29,219,48],{"emptyLinePlaceholder":47},[29,221,223],{"class":31,"line":222},34,[29,224,225],{},"CLOSE CU_OBJS\n",[29,227,229],{"class":31,"line":228},35,[29,230,231],{},"DEALLOCATE CU_OBJS\n",[29,233,235],{"class":31,"line":234},36,[29,236,48],{"emptyLinePlaceholder":47},[29,238,240],{"class":31,"line":239},37,[29,241,48],{"emptyLinePlaceholder":47},[29,243,245],{"class":31,"line":244},38,[29,246,247],{},"-- Now transfer Stored Procedures\n",[29,249,251],{"class":31,"line":250},39,[29,252,48],{"emptyLinePlaceholder":47},[29,254,256],{"class":31,"line":255},40,[29,257,110],{},[29,259,261],{"class":31,"line":260},41,[29,262,263],{},"SELECT sys.schemas.name, sys.procedures.name\n",[29,265,267],{"class":31,"line":266},42,[29,268,269],{},"FROM sys.procedures,sys.schemas\n",[29,271,273],{"class":31,"line":272},43,[29,274,275],{},"WHERE sys.procedures.schema_id=sys.schemas.schema_id and sys.schemas.name = @OldSchema\n",[29,277,279],{"class":31,"line":278},44,[29,280,48],{"emptyLinePlaceholder":47},[29,282,284],{"class":31,"line":283},45,[29,285,139],{},[29,287,289],{"class":31,"line":288},46,[29,290,48],{"emptyLinePlaceholder":47},[29,292,294],{"class":31,"line":293},47,[29,295,150],{},[29,297,299],{"class":31,"line":298},48,[29,300,156],{},[302,303,304],"style",{},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":24,"searchDepth":38,"depth":38,"links":306},[],"2020-10-13T13:50:59.878Z","Copying SQL Databases, renaming is not as easy as it could be.  Luckily the following script can make the effort much easier.  Give it a try. After copying a SQL Server database I needed to create a new schema and transfer all tables and views and stored procedures from the old schema to the newly created schema.  Using the following script made this task much easier.","md","\u002Farticles\u002Fimages\u002Fsingleton_thumb.png",{},"\u002Farticles\u002Frename-sql-server-schema",{"title":6,"description":308},"articles\u002Frename-sql-server-schema",[23],"mvDlpJpU00m0MVu_Frr5AdZnQYdcoEq59ox8SmjvJgs",[318],{"id":319,"title":320,"body":321,"description":325,"extension":309,"img":326,"meta":327,"name":23,"navigation":47,"path":328,"seo":329,"stem":330,"__hash__":331},"tags\u002Ftags\u002Fsql.md","Sql",{"type":9,"value":322,"toc":323},[],{"title":24,"searchDepth":38,"depth":38,"links":324},[],"SQL is a standard language designed for managing data in relational database management system. SQL stands for Structured Query Language. SQL is a standard programming language specifically designed for storing, retrieving, managing or manipulating the data inside a relational database management system (RDBMS).","https:\u002F\u002Fimages.unsplash.com\u002Fphoto-1598313183973-4effcded8d5e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=675&q=80",{},"\u002Ftags\u002Fsql",{"description":325},"tags\u002Fsql","HleFpAIKGUPMxp855dHtmfuv32MNyIbaOTi0ZjW_I1k",{"id":333,"title":334,"author":7,"body":335,"createdAt":425,"description":426,"extension":309,"img":427,"meta":428,"navigation":47,"path":429,"seo":430,"stem":431,"tags":432,"updatedAt":425,"__hash__":434},"articles\u002Farticles\u002Ftool-ditto.md","Tool Tip Ditto Must Have",{"type":9,"value":336,"toc":423},[337,340,343,388,402,408,417,420],[12,338,339],{},"Ditto is an extension to the standard windows clipboard. It saves each item placed on the clipboard allowing you access to any of those items at a later time. Ditto allows you to save any type of information that can be put on the clipboard, text, images, html, custom formats, ..... The features below are simple and just worth repeating within this entry.",[12,341,342],{},"Features",[344,345,346,350,353,356,359,362,365,368,371,374,377],"ul",{},[347,348,349],"li",{},"Easy to use interface",[347,351,352],{},"Search and paste previous copy entries",[347,354,355],{},"Keep multiple computer's clipboards in sync",[347,357,358],{},"Data is encrypted when sent over the network",[347,360,361],{},"Accessed from tray icon or global hot key",[347,363,364],{},"Select entry by double click, enter key or drag drop",[347,366,367],{},"Paste into any window that excepts standard copy\u002Fpaste entries",[347,369,370],{},"Display thumbnail of copied images in list",[347,372,373],{},"Full Unicode support(display foreign characters)",[347,375,376],{},"UTF-8 support for language files(create language files in any language)",[347,378,379,380,387],{},"Uses sqlite database (",[381,382,386],"a",{"href":383,"rel":384},"http:\u002F\u002Fwww.sqlite.org",[385],"nofollow","www.sqlite.org",")",[12,389,390,391,396,397,401],{},"The extension can be found at ",[381,392,395],{"href":393,"target":394},"https:\u002F\u002Fditto-cp.sourceforge.io\u002F","_blank","Ditto","  Source code and issues are tracked via ",[381,398,400],{"href":399,"target":394},"https:\u002F\u002Fgithub.com\u002Fsabrogden\u002FDitto","github","  Written in c++",[12,403,404],{},[405,406],"img",{"alt":24,"src":407},"\u002Farticles\u002Fimages\u002Fditto.png",[12,409,410,411,414],{},"I use this extension daily on all my workstations.  I am able to Copy (Ctrl-C) anything and then use keyboard shortcut Alt-Z to show the last x number (confiburable) of copies display in a pop-up.",[412,413],"br",{},[405,415],{"alt":24,"src":416},"\u002Farticles\u002Fimages\u002Fditto_screen1.png",[12,418,419],{},"Anything in ditto can be found by searching in the open dialog box.  This feature is invaluable when trying to find content from a couple of days ago.  Ditto starts on system startup and is always just available.",[12,421,422],{},"I have tried other clipboard manager tools, but this one is just small, easy and allows me copy\u002Fpaste text, code, images from days in the past.",{"title":24,"searchDepth":38,"depth":38,"links":424},[],"2021-12-05","Clipboard utility that is a must have.  Easy to use interface, search and paste previous copy entries, keep multiple computer's clipboards in sync, accessed from tray icon or global hot key, display a thumbnail of copied images etc.","\u002Farticles\u002Fimages\u002Fditto1.png",{},"\u002Farticles\u002Ftool-ditto",{"title":334,"description":426},"articles\u002Ftool-ditto",[433],"tools","ffOa-BrPCpCv3DthBZ8NpYKGXC5GM95KYDG6MZjz1Sw",{"id":436,"title":437,"author":7,"body":438,"createdAt":504,"description":505,"extension":309,"img":501,"meta":506,"navigation":47,"path":507,"seo":508,"stem":509,"tags":510,"updatedAt":504,"__hash__":512},"articles\u002Farticles\u002Fazure-appservice-http-error-50030-ancm-in-process-start-failure.md","Azure AppService HTTP Error 500.30 ANCM InProcess Start Failure",{"type":9,"value":439,"toc":502},[440,443,446,449,452,455,462,468,470,472,483,488,499],[12,441,442],{},"Again, up against the 500.30 –> really means that something is wrong (usually configuration, appsettings incorrect etc.) which prevents the application from starting up.",[12,444,445],{},"Todays', resolution…",[12,447,448],{},"- Launch Kudu from the Azure Portal (under Advanced Tools)",[12,450,451],{},"- Use Debug console – CMD",[12,453,454],{},"- Use command prompt DOS commands to navigate to \\site\\wwwroot",[12,456,457,458],{},"- Try starting the application via dotnet web.dll ",[459,460,461],"em",{},"(the name of your web application dll)",[12,463,464,467],{},[459,465,466],{},"- ","With any luck, the output will show log errors and with some thought you can decipher what configuration piece is missing (in this case, my connection string was incorrect and I was missing App_Data directory)",[412,469],{},[412,471],{},[344,473,474,477,480],{},[347,475,476],{},"The application failed to start",[347,478,479],{},"The application started but then stopped",[347,481,482],{},"The application started but threw an exception during startup",[484,485,487],"h4",{"id":486},"troubleshooting-steps","Troubleshooting steps:",[344,489,490,493,496],{},[347,491,492],{},"Check the system event log for error messages",[347,494,495],{},"Enable logging the application process' stdout messages",[347,497,498],{},"Attach a debugger to the application process and inspect",[381,500],{"href":501},"\u002Farticles\u002Fimages\u002Fimage_637348425926534448.png",{"title":24,"searchDepth":38,"depth":38,"links":503},[],"2020-09-04T18:56:32.880Z","While hosting an application within Azure AppService, I was up against the dreaded 500.30 ANCM exception.  Following is an approach to help get to resolution.",{},"\u002Farticles\u002Fazure-appservice-http-error-50030-ancm-in-process-start-failure",{"title":437,"description":505},"articles\u002Fazure-appservice-http-error-50030-ancm-in-process-start-failure",[511],"azure","k2bCHrW85oXKlPnYGZmUFSD9tgg9OapWFupo2DLTSBs",1781574766987]