[{"data":1,"prerenderedAt":249},["ShallowReactive",2],{"article-sql-server-and-find-all-columns-in-a-database":3},{"article":4,"tags":81,"previous":96,"next":127},{"id":5,"title":6,"author":7,"body":8,"createdAt":70,"description":71,"extension":72,"img":73,"meta":74,"navigation":75,"path":76,"seo":77,"stem":78,"tags":79,"updatedAt":70,"__hash__":80},"articles\u002Farticles\u002Fsql-server-and-find-all-columns-in-a-database.md","SQL Server and Find all Columns in a Database","[object Object]",{"type":9,"value":10,"toc":68},"minimark",[11,15,57,64],[12,13,14],"p",{},"Where the column name matches exactly…",[16,17,22],"pre",{"className":18,"code":19,"language":20,"meta":21,"style":21},"language-sql shiki shiki-themes github-light github-dark","SELECT name FROM sysobjects WHERE id IN ( SELECT id FROM syscolumns\nWHERE name = '{text}' )\nWhere the column name is like…\nSELECT name FROM sysobjects WHERE id IN \n    ( SELECT id FROM syscolumns WHERE name like '%{text}%' )  \n","sql","",[23,24,25,33,39,45,51],"code",{"__ignoreMap":21},[26,27,30],"span",{"class":28,"line":29},"line",1,[26,31,32],{},"SELECT name FROM sysobjects WHERE id IN ( SELECT id FROM syscolumns\n",[26,34,36],{"class":28,"line":35},2,[26,37,38],{},"WHERE name = '{text}' )\n",[26,40,42],{"class":28,"line":41},3,[26,43,44],{},"Where the column name is like…\n",[26,46,48],{"class":28,"line":47},4,[26,49,50],{},"SELECT name FROM sysobjects WHERE id IN \n",[26,52,54],{"class":28,"line":53},5,[26,55,56],{},"    ( SELECT id FROM syscolumns WHERE name like '%{text}%' )\n",[12,58,59,60,63],{},"The following will show all occurrences of the column in any object",[61,62],"br",{},"\nSELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME LIKE '%doctorid%'",[65,66,67],"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":21,"searchDepth":35,"depth":35,"links":69},[],"2015-04-20T08:07:16.9200000-04:00","Find all occurrences of the column in any object.","md","\u002Farticles\u002Fimages\u002F01dQC8VR9Q.png",{},true,"\u002Farticles\u002Fsql-server-and-find-all-columns-in-a-database",{"title":6,"description":71},"articles\u002Fsql-server-and-find-all-columns-in-a-database",[20],"7j7MoIgvvTBgGhiyTLQS8O1mSrOntcrI4ggv0hVclEs",[82],{"id":83,"title":84,"body":85,"description":89,"extension":72,"img":90,"meta":91,"name":20,"navigation":75,"path":92,"seo":93,"stem":94,"__hash__":95},"tags\u002Ftags\u002Fsql.md","Sql",{"type":9,"value":86,"toc":87},[],{"title":21,"searchDepth":35,"depth":35,"links":88},[],"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":89},"tags\u002Fsql","HleFpAIKGUPMxp855dHtmfuv32MNyIbaOTi0ZjW_I1k",{"id":97,"title":98,"author":7,"body":99,"createdAt":70,"description":119,"extension":72,"img":115,"meta":120,"navigation":75,"path":121,"seo":122,"stem":123,"tags":124,"updatedAt":70,"__hash__":126},"articles\u002Farticles\u002Fsharepoint-2010-iterating-sites-com-factory-error.md","SharePoint 2010 Iterating Sites–COM Factory Error",{"type":9,"value":100,"toc":117},[101,104,107],[12,102,103],{},"Platform: Windows 7, 64 bit, .NET 4 Windows App\u002FConsole App     Error: Retrieving the COM class factory for\ncomponent with CLSID {BDEADF26-C265-11D0-BCED-00A0C90AB50F} failed due to the following error: 80040154 Class not\nregistered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).   ",[12,105,106],{},"Solution: Your debug configuration must use x64 as its active solution platform.",[12,108,109,110,112],{},"Otherwise you're going to get a very non-intuitive message like that shown above.  You can change this by picking Configuration\nManager from the Build menu or from the Solution Configurations drop down menu in your toolbar. Make sure the Active Solution Platform is not x86.",[61,111],{},[113,114],"img",{"src":115,"alt":21,"style":116},"\u002Farticles\u002Fimages\u002Ferror.jpg","display:none;",{"title":21,"searchDepth":35,"depth":35,"links":118},[],null,{},"\u002Farticles\u002Fsharepoint-2010-iterating-sites-com-factory-error",{"title":98,"description":119},"articles\u002Fsharepoint-2010-iterating-sites-com-factory-error",[125],"sharepoint","BsSgOHf3cn3e90uu93Lgc55IUUa_cRQha4xY_nFeEkc",{"id":128,"title":129,"author":7,"body":130,"createdAt":240,"description":241,"extension":72,"img":119,"meta":242,"navigation":75,"path":243,"seo":244,"stem":245,"tags":246,"updatedAt":240,"__hash__":248},"articles\u002Farticles\u002Fsql-server-comparing-tables-merge-except-intersect.md","SQL Server Comparing Tables",{"type":9,"value":131,"toc":238},[132,135,167,179,191,194,200,203,233,236],[12,133,134],{},"I had a need to compare two SQL Server table for differences between them. \nI started using .NET dataset features (merge, acceptchanges, getchanges) as follows: ",[136,137,139,140,144,145,148,149,151,152,155,156,158,159,162,163,166],"div",{"style":138},"font-size: 9pt; background: white; color: black; font-family: consolas","\n        ",[26,141,143],{"style":142},"color: blue","Dim"," data1 DataSet = ",[26,146,147],{"style":142},"GetData1()","          ",[26,150,143],{"style":142}," data2 DataSet = ",[26,153,154],{"style":142},"GetData2()","            ",[26,157,143],{"style":142}," ds ",[26,160,161],{"style":142},"As"," ",[26,164,165],{"style":142},"New"," DataSet         ds.Merge(data1)         ds.AcceptChanges()         ds.Merge(data2)         ds.GetChanges(DataRowState.Modified)",[12,168,169,170,174,178],{},"There are a few gotcha's with the above code.  The primary problem was that\nboth tables must have primary keys defined.  I figured ok,\nI could create primary keys through code for the related DataTables however\nI soon realized that there were duplicate rows within the tables. SQL Server\n2005 has Except and Intersect functions (",[171,172],"a",{"title":173,"href":173},"http:\u002F\u002Fmsdn.microsoft.com\u002Fen-us\u002Flibrary\u002Fms188055(SQL.90).aspx",[171,175,173],{"href":173,"rel":176},[177],"nofollow",") that return distinct values by comparing the results of two queries.  The entire row is compared against another row from another table.",[12,180,181,182,186,187,190],{},"Except returns any distinct values from the left query that are not found on the right query.\nIntersect returns any distinct values that are returned by ",[183,184,185],"strong",{},"both"," the query on the left and right sides. In order to use the number and order\nof the columns must be the same in the queries and also the data types must be comparable.   To return all rows in table1 that do not match exactly the rows\nin table2, you can use Except ...\nselect * from table1 ",[183,188,189],{},"except"," select * from table2",[12,192,193],{},"(likewise to find the opposite just reverse the table names above)",[12,195,196,197,190],{},"To return all rows in table1 that match exactly what is in table2, using Intersect...\nselect * from table1 ",[183,198,199],{},"intersect",[12,201,202],{},"Combining the above two... (the following will return the differences)",[16,204,206],{"className":18,"code":205,"language":20,"meta":21,"style":21},"select 'table1' as tblName, *  from\n  (select * from Table1 except select * from Table2) x\nunion all\nselect 'table2' as tblName, *  from\n  (select * from Table2 except select *  from Table1 ) x\n",[23,207,208,213,218,223,228],{"__ignoreMap":21},[26,209,210],{"class":28,"line":29},[26,211,212],{},"select 'table1' as tblName, *  from\n",[26,214,215],{"class":28,"line":35},[26,216,217],{},"  (select * from Table1 except select * from Table2) x\n",[26,219,220],{"class":28,"line":41},[26,221,222],{},"union all\n",[26,224,225],{"class":28,"line":47},[26,226,227],{},"select 'table2' as tblName, *  from\n",[26,229,230],{"class":28,"line":53},[26,231,232],{},"  (select * from Table2 except select *  from Table1 ) x\n",[12,234,235],{},"If you are fortunate to have primary keys you can of course still use IN\u002FNOT IN type queries however it seems that\nperformance is much improved with the Except\u002FIntersect approach.",[65,237,67],{},{"title":21,"searchDepth":35,"depth":35,"links":239},[],"2015-04-20T08:07:16.8200000-04:00","Learn how to compare two SQL Server tables",{},"\u002Farticles\u002Fsql-server-comparing-tables-merge-except-intersect",{"title":129,"description":241},"articles\u002Fsql-server-comparing-tables-merge-except-intersect",[247],"sqlserver","a3XLSKncpyYY6AaLiNGJj9hTlH1eTB877PjeGfHig8M",1781574767551]