Forum Replies Created

Viewing 15 posts - 1,966 through 1,980 (of 3,543 total)

  • RE: box like charecter

    Just to pitch in

    SELECT CAST([columnname] as varbinary(8000))

    will display the string in hex and you can see what and how many non printable...

  • RE: Spilt excel file into multiple excel files

    CREATE TABLE #temp (location int, [name] varchar(40), DOB datetime)

    INSERT INTO #temp (location, [name], DOB)

    SELECT location, [name], DOB

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

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

    DECLARE @location int

    SELECT @location =...

  • RE: Create/export csv file from sql server table

    or use BCP

    exec master..xp_cmdshell 'bcp database.owner.tablename out outputfilename -c -t "," -S servername -T'

     

  • RE: Spilt excel file into multiple excel files

    in TSQL

    INSERT INTO

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

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

    (location, [name], DOB)

    SELECT location, [name], DOB

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

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

    WHERE location = 'locationwanted'

    the only caveat with this method is...

  • RE: Return Code with isql, osql or isqlw

    Try this

    osql -S <server> -E  -b -m-1 -i <not_changeable_sql_script.sql> -o <output>

    IF ERRORLEVEL 1 GOTO ERROR_LABEL

  • RE: SQL query problem

    WHERE @col1 LIKE 'abc_def'

  • RE: Update Table for records up to a specified quantity

    quote...but your solution uses some implicit assumptions that are not given ...

    But your observations are assumptions also,...

  • RE: Update Table for records up to a specified quantity

    UPDATE a

    SET a.[Scheduled Amount] = a.[Scheduled Amount] + CASE WHEN (@Qty - b.Summ) > (a.Quantity - a.[Scheduled Amount]) THEN (a.Quantity - a.[Scheduled Amount]) ELSE (@Qty - b.Summ - a.[Scheduled...

  • RE: Update Table for records up to a specified quantity

    No problem

    I had to look twice myself just to make sure

  • RE: Update Table for records up to a specified quantity

    quoteA little tweak to seems (to me) to meet all the requirements (including the priority one)...

    My solution...

  • RE: Update Table for records up to a specified quantity

    a possible solution

    DECLARE @Material NVarChar(32), @Qty int

    SET @Material = 'MATERIAL1'

    SET @Qty = 350

    UPDATE a

    SET a.[Scheduled Amount] = CASE WHEN (@Qty - b.Summ) > a.Quantity THEN a.Quantity ELSE (@Qty -...

  • RE: 5 Table Join

    Just guessing  but I think the problem is the join between PartRace and IndResults not matching on RaceID

    SELECT p.ParticipantID, pr.Age, ir.FnlTime, e.EventDate

    FROM Participant p...

  • RE: format data in query

    Could use if int (if not int then STR will round)

    REPLACE(STR(Amount,13,0),' ','0')

    or with decimal point

    REPLACE(STR(Amount,13,2),' ','0')

    or without decimal point but including decimal part

    STUFF(REPLACE(STR(Amount,14,2),' ','0'),12,1,'')

  • RE: Removing High Ascii (>128)

    If the fields are varchar then

    create the numbers table thus

    CREATE TABLE [numbers] (number int PRIMARY KEY CLUSTERED)

    and populate with numbers from 1 to 8000

    and use

    DECLARE @result varchar(8000)

    SET @result...

  • RE: Check 3 columns to return single value

    The same without nesting

    CASE

    WHEN IsPage=1 THEN 'Page'

    WHEN IsFolder=1 THEN 'Folder'

    WHEN ISMenu=1 THEN 'Menu'

    ELSE 'Unknown'

    END

Viewing 15 posts - 1,966 through 1,980 (of 3,543 total)