Forum Replies Created

Viewing 15 posts - 61 through 75 (of 167 total)

  • RE: T-SQL Data Processing

    This process was designed on a SQL 2000 system and ported to SQL 2005 with minimal changes. When I refactor it for SQL 2005 that would be the way to...

  • RE: T-SQL Data Processing

    I'm not a fan of dedup either, and didn't expect a harty round of approbation from this article...

    I've found that you should ALWAYS consider your alternatives when it comes to...

  • RE: PatIndex on varbinary Column

    Try something like this (adapted to your environment):

    Declare @s-2 varchar(256),@v varbinary(256)

    Select

    @s-2='String with wierdness'+Char(127)+' in it...',

    @v-2=cast(@s as varbinary)

    Print @s-2

    Print @v-2

    Print patindex('%'+Char(127)+'%',cast(@v as varchar))

    I've run into cases where the above PATINDEX may...

  • RE: Correlated Joins Using "Apply"

    We sometimes create our own "full-Text" indexes instead of using SQL's Full-Text feature because we have non-standard requirements...

    I'll create a Multi-Statement table-valued function that parses a string parameter into a...

  • RE: SQL Hex Character conversion?!

    This looks like an HTML or XML data conversion. Are you using either to post your queries to SQL?

  • RE: CASTing

    The answer to this question is technically correct...

    While Len(@c) is in fact 4000 the type and maximum len of @c is VarChar, 8000.

    Try concatenating another 4000 VarChar characters to @c...

  • RE: Removing Duplicate Records

    If the ratio of duplicate to unique phone numbers is "small" AND you have a unique row identifier on the table you might be better off doing something like this...

    If...

  • RE: Convert for hh:mm:ss

    I use a function like this for general interval timing in TSQL...

    If Object_Id('TimeSpan','fn') is not Null Drop Function TimeSpan

    Go

    Create Function TimeSpan

    (

    @StartDT DateTime,

    @EndDT DateTime

    )

    Returns VarChar(16)

    As Begin

    Declare @s-2 VarChar(64),@s1...

  • RE: Is there a command for printing to a text file in T-SQL?

    ...or you could use:

    sp_OACreate 'Scripting.FileSystemObject'...

    sp_OAMethod ...'Write or WriteLine'...

    Create a sproc to open the output file then use a function to write lines to it...

  • RE: BEGIN and END in stored procedure

    I've seen code like this (.. is an indentation, this forum strips leading spaces?!?):

    IF somecondition

    ..dosomething

    where the program will come along later and add another command after the IF thinking...

  • RE: Using WAITFOR and PRINT in a loop does not show any result

    The previous poster is correct about using RAISERROR as opposed to PRINT to eliminate output queing, however, RAISERROR has a feature that my cause you problems if you are not...

  • RE: Help with CASE statement.

    Case

    When x in ('a','b','c') then 'yep'

    Else 'nope'

    End

  • RE: EXISTS Subqueries: SELECT 1 vs. SELECT * (Database Weekly 11.02.2008)

    In MSSQL Server Management Stdio with "Include Actual Execution Plan" turned on I ran this using a table with lots of rows and a WHERE clause with low specificity...

    dbcc dropcleanbuffers;

    set...

  • RE: Query to generate a comma separated field

    If you know all the potential course names you could play this game...

    Use Tempdb

    if object_id('dbo.#Course') is not Null Drop table dbo.#Course

    Select 'John'[Student],'Math'[Course] into dbo.#Course

    Union All Select 'Steve','Science'

    Union All Select 'Don','Math'

    Union...

  • RE: FYI: Convert Hex string data to Int/BigInt

    No question, just ran across this issue while researching another topic, thougth I'd drop my 2 cents worth for the forum...

    I'll use Scripts next time.

Viewing 15 posts - 61 through 75 (of 167 total)