Forum Replies Created

Viewing 15 posts - 631 through 645 (of 683 total)

  • RE: Import a variable text file

    Hi Carl,

    I'm not sure I realised before that you weren't the original poster

    I'm not that familiar with BULK INSERT, but I just looked...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: Flatten a table

    Jonathan,

    I'd only recommend using a cursor in this situation if you want poor performance and derision from most people on this site

    The...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: shipping system - stored procedure - self-referencing table

    Ang,

    That was a fun problem 

    Here's something for starters for you to play with. It should give all possible journeys - but might need...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: Data Comaprision

    Rajesh,

    Is this what you want?

    --This SQL script is safe to run

    --Create table and data

    DECLARE @Product_feature TABLE (Product_id VARCHAR(2), Feature_code VARCHAR(2))

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: Flatten a table

    There are a few methods - none of which is that straightforward, but do the job. I've used one method as an example below

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: Import a variable text file

    Once you've got your 1 column table to SQL, you can try a variation of this kind of thing (just try running it and you should get the idea

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: Selecting parts of a string

    Hi all,

    I started playing with the PARSENAME way of doing this (for fun, and taking into consideration what's been mentioned), and got a bit carried away.

    I'm not certain it...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: Adding a Sequential Number to a Select Statement

    This kind of thing has been discussed many times before on here. Here's one simple way (as an example)...

    CREATE TABLE #T1 (name SYSNAME, par INT IDENTITY(1, 1))

    INSERT INTO #T1...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: Spilt excel file into multiple excel files

    Unless there's more to the problem than you've described, I'd solve it using VBA, rather than T-SQL (in which case this is the wrong forum, so apologies).

    Something along the lines...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: Splitting and aggregating a field with commas

    Just working on that now...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: Splitting and aggregating a field with commas

    This does the trick:

    --This code is safe to run

    DECLARE @animals TABLE (ListOfAnimals VARCHAR(100))

    INSERT INTO @animals

     SELECT 'cat, dog, mouse'        UNION ALL

     SELECT ' mouse,dog,...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: Convert into Flat Table

    Galahad,

    Ray's right that you need to post more information about your problem. How do you know, for example, that rows 1, 3 and 5 (or 2, 4 and 6) in your...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

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

    I see paramind - that's what you're thinking. In that case, I guess changing...

    INNER JOIN (SELECT s1.Orderref, SUM(ISNULL(s2.Quantity,0)) AS [Summ]

    ...to...

    INNER JOIN (SELECT s1.Orderref, SUM(ISNULL(s2.Quantity,0)-ISNULL(s2.[Scheduled Amount],0)) AS [Summ]

    ...might do...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

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

    Well, I prefer David's method. A little tweak to seems (to me) to meet all the requirements (including the priority one)...

    SET @Material = 'MATERIAL1'

    SET @Qty = 350

    UPDATE a

    SET a.[Scheduled Amount] =...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: display multiple lines from based on qty

    I think the '<=' should be a '>=', but Sergiy's solution is a good one.

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • Viewing 15 posts - 631 through 645 (of 683 total)