Being (me)

Site Details
Current Rank: 39 (Technology & Computers)
Site Description: Mainly how-to's on different things but focusing mostly on T-SQL and SQLServer tips and tricks
Date Joined: Jul 20, 2008

Tags: tsql, sql server, how, tutorial, code

Latest Blog Posts

How to: create login with 'sa' credentials
on Oct 4, 2010 in sample code CREATE LOGIN loginname WITH PASSWORD = 'changeme' MUST_CHANGE ,CHECK_EXPIRATION = ON ,DEFAULT_DATABASE = DBNameGOEXECUTE sp_addsrvrolemember @loginame = 'loginname', @rolename = 'sysadmin'...

How to: assign IDs/SortVal values using ROW_NUMBER()
on Mar 28, 2010 in tsql row_number() I have a lookup table L_MyLookup with columns ID and NAME.Later, my client wanted a SORTVAL column because they want to define the order of the values through that column instead of ID.So add the SORTVAL columnupdate the valuesalter SORTVAL to become...

FTS: Drop Catalog
on Mar 25, 2010 in full text search tutorial sp_fulltext_table 'MyTable', 'drop'gosp_fulltext_database 'enable'gosp_fulltext_catalog 'MyFTSCatalog', 'drop'gosp_fulltext_service 'clean_up'go...

FTS: Create new Catalog
on Mar 25, 2010 in full text search tutorial See: how to drop existing FTS CatalogEXEC sp_fulltext_database 'enable'goCREATE FULLTEXT CATALOG MyFTSCataloggoCREATE FULLTEXT INDEX ON MyTable( Document TYPE COLUMN DocumentExtension LANGUAGE 0x...

SSIS auto generate update scripts
on Mar 4, 2010 in SSIS Specify the TableName in @TableName variable to create the Update script to be used for SSIS.DECLARE @counter int; DECLARE @QueryString nvarchar(2400) = '' DECLARE @ColumnName nvarchar(120); DECLARE @TableName nvarchar(120) = 'MyTable' CREATE...

on Mar 4, 2010 in SSIS I'm working on several SSIS Transfer Packages right now and I just figured out how to do an "UPSERT": How to insert rows that don't exist in the destination table and how to update rows that exist in both source and destination tables. This will work...

How to select value from strongly typed XML
on Feb 18, 2010 in xml Table Name: TableHasXMLhas Column: XML_Column xml(XMLCollectionSchema)XML data is similar to:[root xmlns="" ....] [row ] [column1]Things We Love to Hate[/column1] [column2]http://www.thi...

How to know if a string is part of an XML?
on Feb 11, 2010 in string manipulation xml I have a table named "TempTable" with an XML column named "XML_Collection". Now I want to know if the string "My Valentine" appears in any of those XML rows.I used the string manipulator: PATINDEXSELECT * from TempTable WHERE PATINDEX('%My Valentine%...

TSQL Latin Collation Error
on Sep 30, 2009 in sql collation tsql error how to change Error encountered:Cannot resolve the collation conflict between "Latin1_General_CI_AS" and "SQL_Latin1_General_CP1_CI_AS" in the equal to operation.I'm not sure if it's as convenient with the earlier versions but SQL Server 2008 allows you to easily...

Select XML Schema Collection type of an XML Column
on Sep 8, 2009 in collection schema type column xml select convert I spent an afternoon looking for a way to get the XML Schema Collection type of a given column.I wanted to copy the contents of a table (that has an XML column with a user defines Schema Collection) to another table but I get this error message: Impl...

Unique Visitors Today: 0
Page Views Today: 0
Unique Visitors this Week: 0
Page Views this Week: 0
Unique Visitors this Month: 64
Page Views this Month: 69
Total Unique Visitors: 55,523
Total Page Views: 61,664
Total Hits Out: 337

Site Traffic