Forum Replies Created

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

  • RE: Need to PIVOT without aggregate function

    Can you post a sample of what you are trieng to do ? DDL/Data/Result required

  • RE: raise error

     EXEC('BULK INSERT Emp FROM ''E:\Development\Emp\'+@FileName+'.txt''

     WITH (formatfile =''E:\Development\Emp\InputFormat.fmt'')')

    =

     

    DECLARE @MySQL NVARCHAR(4000)

    SET @MySQL ='BULK INSERT Emp FROM '''+@FileName+''' WITH (formatfile =''E:\Development\Emp\InputFormat.fmt'')'

    PRINT @MySQL

    EXEC (@MySQL)

  • RE: raise error

    can you post again what you did ?

     

    this one works

    SET NOCOUNT ON

    DECLARE @File_Exists  INT

    ----------------------------------------------------------

    DECLARE @FileName NVARCHAR(50)

    SET @FileName='IO'

    ----------------------------------------------------------

    SET @FileName='C:\'+@FileName+'.sys'

    EXEC Master..xp_fileexist @FileName, @File_Exists OUTPUT

    SELECT @File_Exists as Existss,@FileName as FileNames

    SET @FileName=@FileName+'sys'

    EXEC Master..xp_fileexist @FileName,...

  • RE: RelationShip Problem & StoreProcedure Problem

    Payment Types:  (reference No , PaymentId)

    Cash Payment:    (paymentId, cashPaymentDate, cashReceiptsNo)

    CreditCardPayment:   (paymentId, expiration Date, card Name, authorization Date)

    ChequePayment:      (paymentId, locOut, bank Name, branch...

  • RE: raise error

    yep you can t do that

    you have to prepare file name before in a variable

    SET @FileName='E:\Development\Emp\'+@FileName+'.txt'

    EXEC Master..xp_fileexist @FileName, @File_Exists OUTPUT

  • RE: trying to UPDATE a table

    declare @periodo_inicio as datetime

    declare @periodo_fim as datetime

    declare @periodo_temp as int

    declare @periodo_temp2 as decimal(12,2)

    declare @periodo_temp3 as int

    declare @periodo_colA as varchar(20)

    declare @periodo_colB as varchar(20)  

    set @periodo_temp = 1

     DECLARE periodo CURSOR FOR

     SELECT DISTINCT *...

  • RE: raise error

    EXEC Master..xp_fileexist 'E:\Development\Emp\@FileName.txt', @File_Exists OUTPUT

    ya after a closer look .... this file DOESN T EXISTS

    this one might

    EXEC Master..xp_fileexist 'E:\Development\Emp\'+@FileName+'.txt', @File_Exists OUTPUT

  • RE: raise error

    both files? the format and source file ?

    I tried the statement and it works fine ... the problem is somewhere else...

    Did you HARDCODED the file name for testing purposes?

  • RE: Converting varchar to a datetime datatype

    is weired that someone mixed data like that...

    Take a look at SET DATEFORMAT and run that query again the problem might be that you preferences are in different format than...

  • RE: raise error

    can t jump to else if return value is 1

    the problem is that when you test you use a USER that has access...

  • RE: badly written SQL

    SELECT * FROM B

    WHERE

    NOT((B.type = 'IN' AND (ISNULL(B.IN_Opening_Stock,0) = 0 AND (ISNULL(B.sp_Int_Cum_Actual,0) = 0 AND (ISNULL(B.sp_Int_Projected_Tonnes,0) = 0) OR

        (B.type = 'OP' AND (ISNULL(B.OP_Month_Tar_Prod_Ton,0) = 0) AND (ISNULL(B.OP_Actual_Production,0) = 0...

  • RE: raise error

    -did you check if the file really exists?

    -the executing user has required security rights to access the file?

  • RE: raise error

    If @File_Exists=1

      BEGIN

     TRUNCATE TABLE SIRSInput

     EXEC('BULK INSERT Emp FROM ''E:\Development\Emp\'+@FileName+'.txt''

     WITH (formatfile =''E:\Development\Emp\InputFormat.fmt'')')

    END

    ELSE

     BEGIN

       RAISERROR ('File does not exist!', 16, 1)

      END

  • RE: Zeroise small sums

    DECLARE @t TABLE(fee_earner_id INT, fees MONEY)

    INSERT INTO @t

    SELECT 123, 23.54 UNION ALL

    SELECT 245,  0.03 UNION ALL

    SELECT 345, -0.46

     

    SELECT fee_earner_id,CASE  WHEN ABS(SUM(fees))<0.5 THEN 0 ELSE SUM(fees) END AS fees

    FROM @t

    GROUP BY...

  • RE: Need Help with a Cursor

    you can t write this (as you saw allready)

    IF #lmreport.terrid='T'                     <------- error here

     

    if you want to test if there is any terrid equal...

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