x002548's Blog

Not Just a Number - Brett Kaiser
posts - 89, comments - 586, trackbacks - 39

July 2006 Blog Posts

T-SQL HTML? Parser

EDIT:  Ok, so as is pointed out in the comments below SQL Server comes with a very powerful XML Parser already OPENXML and sp_xml_preparedocument.  I posted a code snipet in the comments I got from BOL so you can see how it works.  While my routine operaes in a different manner, it seems to have been an exercise in futility...but it was fun writing it...annd hey maybe it will come in hany.  Who knows. A poster over at SQLTeam asked a question on how to “read“ xml data from a string.  Now I had always toyed with the idea of parsing XML...

posted @ Thursday, July 27, 2006 2:29 PM | Feedback (6) | Filed Under [ SQL Server ]

Generate Fixed width Format Cards (New Version)

Thought I lost this...so I figured I better post it.  It will create format cards for all tables in the database. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[isp_GenFormatCards]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) drop procedure [dbo].[isp_GenFormatCards] GO CREATE PROC isp_GenFormatCards AS DECLARE FormatCard CURSOR FOR SELECT FORMAT_CARD, TABLE_NAME, TABLE_SCHEMA FROM ( /* SELECT '--' + TABLE_NAME AS FORMAT_CARD , TABLE_NAME, null AS COLUMN_NAME, 0 AS SQLGroup, 1 AS RowGrouping FROM INFORMATION_SCHEMA.Tables WHERE TABLE_TYPE = 'BASE TABLE' UNION ALL */ SELECT '7.0' AS FORMAT_CARD , TABLE_NAME, TABLE_SCHEMA, null AS COLUMN_NAME, 1 AS SQLGroup, 1 AS RowGrouping FROM INFORMATION_SCHEMA.Tables WHERE TABLE_TYPE = 'BASE TABLE' UNION ALL SELECT CONVERT(varchar(5),MAX(ORDINAL_POSITION)) AS FORMAT_CARD , c.TABLE_NAME, c.TABLE_SCHEMA, null AS COLUMN_NAME, 2 AS SQLGroup, 1...

posted @ Thursday, July 06, 2006 2:18 PM | Feedback (2) | Filed Under [ Code Generataion ]

Powered by:
Powered By Subtext Powered By ASP.NET