Forum Replies Created

Viewing 15 posts - 46 through 60 (of 920 total)

  • RE: FILO primary key rotation?

    What about using a real identity column with a computed column for your "identity" column?

    create table testid(

    id int identity(0,1),

    fakeid as id%100)

  • RE: how to store numbers of more than 64 bits length

    I need to store an array of bits. I was trying to use bigint that gives me 64 bits but, I can't set all of the bits in 1 cause...

  • RE: Possible to use a trigger to write a file to disk?

    This proc is essentially real-time by default; it will be executed immediately unless you include an optional @whentype other than 1.  The fun of using this proc in a trigger...

  • RE: Possible to use a trigger to write a file to disk?

    You can use the sp_makewebtask system stored procedure for this; read about it in BOL.  You'll probably want to use a template file.

    Using a trigger for something like this incurs...

  • RE: Query question...

    I don't think this is implied.  It is easily conceivable to need such a query in a properly normalized database.   This is a history table of each change in an employee's status,...

  • RE: Create a user-defined function

    Okay, how about something like this?

    SELECT a.Col + b.Col

    FROM #Tab a JOIN #Tab b ON a.Id <> b.Id AND a.Col <= b.Col AND NOT (a.Col = b.Col AND a.Id > b.Id)

  • RE: Query problem

    Or just something like this:

    UPDATE p SET PriceName = LTRIM(STR(ISNULL(

    (SELECT MAX(Price)

     FROM PriceName

     WHERE Price < p.Price),CASE WHEN Price IS NULL THEN

     (SELECT MAX(Price)

      FROM PriceName) ELSE 0 END))) + ISNULL('-' + LTRIM(STR(Price)),'...

  • RE: SQLServer Password Issue

    Unless the master database uses a case-sensitive collation (which would be unusual and requires changing the collation when the server or instance was installed), SQL passwords are case-insensitive...

  • RE: problems with a script

    If this is just an ad hoc utility, I'd just cheat and do something like this:

    DECLARE @value datetime, @sql varchar(400)

    SET @value = '20040129 15:00:00'

    SET @sql =...

  • RE: Query question...

    Perhaps something like this:

    SELECT p.EmployeeID, p.LastName, p.FirstName

    FROM Personnel p JOIN

    (SELECT EmployeeID, MAX(UpdDate) LastDate

     FROM Personnel

     GROUP BY EmployeeID) x ON p.EmployeeID = x.EmployeeID AND p.UpdDate = x.LastDate

  • RE: Create a user-defined function

      Okay, now I finally know what you're trying to do here.

    In SQL, it's a good idea to have a primary key... 

  • RE: Update data

    You only need one SET keyword; i.e.:

    update tbl_a

    set tbl_a.column1 = tbl_b.column1,

    tbl_a.column2 = tbl_b.column2,

    tbl_a.column3 = tbl_b.column3,

    tbl_a.column4 = tbl_b.column4,

    tbl_a.column5 = tbl_b.column5,

    tbl_a.column6 = tbl_b.column6

    from tbl_a,tbl_b

    --join tbl_b

    --on tbl_a.key_id = tbl_b.key_id

    where tbl_a.column5 = tbl_b.column5

    and tbl_a.column6...

  • RE: Create a user-defined function

    The "problem," then is not with the code but instead with your examples.  How about:

    SELECT a.Col + b.Col

    FROM Table a JOIN Table b ON...

  • RE: Crosstab query

    Working from your narrative rather than that interesting code, perhaps you want something like this:

    SELECT Ref, SUM(CASE Armazen WHEN 1 THEN EpcPond END) ARM1, SUM(CASE Amazen WHEN 3 THEN -EpcPond END)...

  • RE: Inserting lots of data into a temp table, does not keep sort order

    I suspect there's a flaw in your SQL code.  You evidently haven't shared much of it.  Without seeing the actual code, it's near impossible to guess at the cause of...

Viewing 15 posts - 46 through 60 (of 920 total)