Forum Replies Created

Viewing 15 posts - 1,921 through 1,935 (of 3,543 total)

  • RE: Strange think with a string chain

    Your problem is the misuse of the SUBSTRING function

    SUBSTRING ( expression , start , length )

    try this

    set @strNoEmple = convert(int,substring(@strLinea,6,10))

     

    set @strApePaterno = substring(@strLinea,16,20)

    set @strApeMaterno = substring(@strLinea,36,20)

     

    set...

  • RE: Trigger SQL to UPDATE Only row being Updated

    You need to JOIN the inserted table to the updated table using the primary key, e.g.

    UPDATE a

    SET ChangeDate = GETDATE()

    FROM TABLE_A a

    INNER JOIN inserted i

    ON...

  • RE: Query statement with Julian/Georgian date field

    Can you explain "Georgian" ?

    I always understood Julian dates were YYDDD or YYYYDDD format

    What do the Date & Time values refer to ?

  • RE: Please help in Outer join

    My guess would be

    SELECT h.salesrep_Name,d.disp_code,[description],count(m.act_status)

    FROM histdata h

    CROSS JOIN dispositions d

    LEFT OUTER JOIN modifiedcalldata m

      ON m.prog_sol_number = h.prog_sol_number...

  • RE: BULK INSERT ERROR MESSAGE

    Happy to help

    quoteIn BOL, their example shows "SQL_Latin_General" for the...
  • RE: BULK INSERT ERROR MESSAGE

    Create the file (e.g. C:\MyFolder\MyFile.fmt) using text editor like notepad

    therefore if your column name was DataCol and is 2500 chars long then create the file with the following on...

  • RE: BULK INSERT ERROR MESSAGE

    To bulk insert into a table that has an identity column you have to use a format file otherwise you will get the error

    Try this

    8.0

    1

    1  SQLCHAR  0  255  "\r\n" ...

  • RE: BULK INSERT PROBLEM

    Try using this fomat file

    8.0

    12

    1  SQLCHAR 0 1  "‘"     0 x     ""

    2  SQLCHAR 0 10 "’"     1 col1  ""

    3  SQLCHAR 0 10 "|"     0 x     ""

    4  SQLCHAR 0 4  "|"    ...

  • RE: Where clause

    This will achieve the same without the WHERE clause

    SET FMTONLY ON

    SELECT Institution, Period FROM Transactions

  • RE: substract the word from the list

    SELECT

    LTRIM(SUBSTRING(',' + t.words + ',', n.number + 1,

    CHARINDEX(',', ',' + t.words + ',', n.number + 1) - n.number - 1))

    FROM [numbers] n

    INNER JOIN @t t

    ON SUBSTRING(','...

  • RE: cross tab with dates

    DECLARE @start datetime, @end datetime, @sql nvarchar(200)

    SET @start = '20060401'

    SET @end = '20060420'

    SET NOCOUNT ON

    CREATE TABLE #temp (techid int)

    INSERT INTO #temp (techid) SELECT DISTINCT techid...

  • RE: How to create an aggregated field

    To show your results (treat year as one period) then

    SELECT a.GL_ID, a.GL_Name_VC,

    SUM(CASE WHEN a.Period_TI = 1 THEN Amount ELSE 0 END) AS [Op Bal],

    SUM(CASE WHEN a.Period_TI > 1...

  • RE: Suming DateDiff

    DECLARE @from datetime, @to datetime

    SET @from = '2006-04-11 10:00:00'

    SET @to = '2006-04-11 11:00:00'

    SELECT COUNT(*)

    FROM (SELECT DATEADD(minute,n.number,@from) AS [Time]

    FROM master.dbo.spt_values n

    WHERE n.type = 'P'

    AND...

  • RE: SlNo in Select Query

    or, if EmpID not consecutive

    SELECT (SELECT COUNT(*) FROM [Emp] b WHERE b.Dept = a.Dept AND b.EmpID <= a.EmpID)

    ,a.EmpID, a.Dept, a.EmpName

    FROM [Emp] a

    ORDER BY a.Dept ASC, a.EmpID ASC

  • RE: Html Results for computed value

    This is the same as my post in other thread

    I am surprised that you get any result since there is an error in...

Viewing 15 posts - 1,921 through 1,935 (of 3,543 total)