Forum Replies Created

Viewing 15 posts - 1,756 through 1,770 (of 3,543 total)

  • RE: Reading Binary Data

    Try

    CAST([columnname] as nvarchar(100))

     

  • RE: Check for 0 rows on list of tables

    Change

    set @mysql = 'select count(*) from ' + @myname

    select @mycnt = count(*) from @myane

    set @mycnt = execute(@mysql)

    to

    set @mysql = 'select @mycnt=count(*) from ' + @myname

    exec sp_executesql @mysql, N'@mycnt int...

  • RE: Why is this subject to deadlocks?

    Ah, OK

    Besides any solution will require a SELECT/JOIN because of the INSERT

  • RE: Unique datetime for each row

    Heck, I only found out when I experimented before my first post

    There is always something in SQL to catch me out

  • RE: Why is this subject to deadlocks?

    quoteDon't use NOT EXISTS. It forces the whole table to be looked at because it has to check...
  • RE: grouping by character data

    If data consists of fixed values then use CASE statements and GROUP BY

    If data consists of variable values then create a function to concatenate data for and use it...

  • RE: Unique datetime for each row

    But for uniqueness it is 4.

    ie add 3 or 4 milliseconds to 13 milliseconds and you will get 17 milliseconds for both

  • RE: Unique datetime for each row

    The only way I can think of is to use temp table/table variable to store the unique key of the selected records plus IDENTITY column and update datetime using the...

  • RE: convert a column of varchar data type to datetime

    Just some observations

    You will not be able to update the new column in a set based update unless all of your dates are valid or SQL will stop at the...

  • RE: Update Table on a LINKED Server

    You could try to reduce the rows selected in the Linked Server like this

    UPDATE u

    SET [LinkCol_1] = l.[LocalCol_1]

    FROM OPENQUERY(LinkedServerName, 'SELECT [LinkCol_ID],[LinkCol_1] FROM DBName..TblName WHERE LinkCol_3]=''ABC''') u

    INNER JOIN...

  • RE: Trigger Syntax Using Columns_updated

    Something like this

    IF ((SUBSTRING(COLUMNS_UPDATED(),1,1) & 128) > 0 OR 

        SUBSTRING(COLUMNS_UPDATED(),2,1) > 0 OR 

       (SUBSTRING(COLUMNS_UPDATED(),3,1) & 7) > 0) AND

       EXISTS(SELECT * FROM [2nd table] WHERE ...)

       RAISERROR ('Record is...

  • RE: Convert month number to month names

    or

    DATENAME(month,DATEADD(month,[monthcolumn],-1))

     

  • RE: Evaluating Derived Columns within a Select

    Are you looking for SQL Server solution?

    Translate Access to TSQL first

    SELECT @YearInput AS [input],

      s.Department,

      s.DateAwarded,

      s.StudentNumber,

      p.Forenames AS fore,

      p.Surname AS Sur,

      s.Mode,...

  • RE: fin date month year diff

    DECLARE @months int

    SET @months = DATEDIFF(month,@firstdate,@seconddate)

    SELECT @months % 12 AS [Months],@months / 12 AS [Years]

    Some more detail and example data and results would be helpful

  • RE: Ways for Importing Excel Data

    You can use

    SELECT * FROM

    OPENROWSET('Microsoft.Jet.OLEDB.4.0',

    'Excel 8.0;HDR=YES;Database=C:\temp\book1.xls', [sheet1$])

    and use dynamic sql to substitute the workbook name

    but beware that when SQL reads Excel files is uses the first few...

Viewing 15 posts - 1,756 through 1,770 (of 3,543 total)