Forum Replies Created

Viewing 15 posts - 121 through 135 (of 189 total)

  • RE: DTS DTSTransformStat_InsertQuery Error Handling

    Because you didn't go into the IF.

    Test it:

    '**********************************************************************

    '  Visual Basic ActiveX Script

    '************************************************************************

    Function Main()

    If 1=1 Then

         MsgBox "one equals one."

    Else

         MsgBox "hell froze over."

    End If

    Main = DTSTaskExecResult_Success

    End Function

    Since none of your...

    [font="Courier New"]ZenDada[/font]

  • RE: Exec query with ActiveX against existing DTS connection

    This is a DTS connection object, not an ADO connection object.  You can definitely code this with the DTS object model.  DTS connection objects have child objects that execute SQL. ...

    [font="Courier New"]ZenDada[/font]

  • RE: DTS DTSTransformStat_InsertQuery Error Handling

    Try one of these flavors:

    If Len(EmpID) < 1 Or IsEmpty(EmpID) Or IsNull(EmpID) Then

        MsgBox "EmpID was not found."

    End If

    Don't use a msgbox on the Server!  That's where it'll appear if...

    [font="Courier New"]ZenDada[/font]

  • RE: Exec query with ActiveX against existing DTS connection

    This will create a reference to your connection:

     Dim oPkg

     Set oPkg = DTSGlobalvariables.parent

     Dim oConn

     Set oConn = oPkg.Connections("myConn")

    However you cannot execute a sql statement against this connection.

    I take it you are trying...

    [font="Courier New"]ZenDada[/font]

  • RE: Help with simple Exec SQL Task

    By the way, when using transformations - if all you are doing is copy columns, go into the transformations tab, delete all, select all, and select copy columns.  You will...

    [font="Courier New"]ZenDada[/font]

  • RE: Help with simple Exec SQL Task

    If all you want to do is run an execsql, you will only have one conn object.  You won't "connect" it to anything with a workflow.  The execsql will use...

    [font="Courier New"]ZenDada[/font]

  • RE: Avoiding cursors, but...

    And you can substitute fields with select statements like this.  Say when you want the next value in a series - you can use a correlated subquery:

    select * from #t...

    [font="Courier New"]ZenDada[/font]

  • RE: Avoiding cursors, but...

    It's called a "derived table".  Search on that term.  Select title, "using the FROM clause" in the location "Accessing and changing relational data".

    [font="Courier New"]ZenDada[/font]

  • RE: Date Format

    "What I'm looking for is something that will return me only the date part of a date time..."

    The equivalent of Oracle's TRUNC is this:

    select cast(convert(varchar(15), getdate(), 101) as datetime) which...

    [font="Courier New"]ZenDada[/font]

  • RE: Month end date

    "The method that doesn't use string manipulation is slightly faster. Which of course has no importance unless the number of times the algorithm runs is ridiculously large."

    Exactly - that's why...

    [font="Courier New"]ZenDada[/font]

  • RE: How to handle ¦ character in query

    declare @str as varchar(10)

    declare @ptr as integer

    declare @ascii as varchar(1000)

    set @str = 'FOOD\r¦ BOX 2'

    set @ptr = 1

    while @ptr <= len(@str)

    begin

    print char(ascii(substring(@str,@ptr,1)))

    print ascii(substring(@str,@ptr,1))

    print '----'

    set @ptr=@ptr+1

    end

     

    F

    70

    ----

    O

    79

    ----

    O

    79

    ----

    D

    68

    ----

    92

    ----

    r

    114

    ----

    ¦

    166

    ----

     

    32

    ----

    B

    66

    ----

    O

    79

    ----

     

    [font="Courier New"]ZenDada[/font]

  • RE: Month end date

    That's snazzy.  I'm keepin' that one!

    [font="Courier New"]ZenDada[/font]

  • RE: Month end date

    Here's your function:

    CREATE FUNCTION dbo.lastdayofmonth

     (@ReportDt datetime)

    RETURNS datetime

    AS

    BEGIN

    declare @fmonth datetime

    declare @lastday datetime

    set @ReportDt = cast(convert(varchar(15), @ReportDt, 101) as datetime)

    set  @fmonth = @ReportDt - Day(@ReportDt) + 1

    set  @lastday = (@fmonth + 31) -...

    [font="Courier New"]ZenDada[/font]

  • RE: Month end date

    Declare @Date as smalldatetime,

     @Fmonth as smalldatetime,

     @EomPrev as smalldatetime,

     @EomCurr as smalldatetime,

     @EomNext as smalldatetime

    set @Date = cast(convert(varchar(15),getdate()+5, 101)as smalldatetime)

    set @Fmonth = (@Date - Day(@Date)+1) -- Sets To First Day Of Current Month

    set...

    [font="Courier New"]ZenDada[/font]

  • RE: Intermediate T-SQL Book Recommendation

    And for stored procedures:

    SQL Server 2000 Stored Procedures Handbook by Wrox

    SQL Server 2000 Programming by Wrox

     

    [font="Courier New"]ZenDada[/font]

Viewing 15 posts - 121 through 135 (of 189 total)