Forum Replies Created

Viewing 15 posts - 721 through 735 (of 907 total)

  • RE: Converting Char datatype to Datetime

    Here is two examples that might help you decide how to handle this:

    -- if 021002 (yymmdd) is October 2, 2002

    select cast('021002' as datetime)

    -- 021003 (ddmmyy) is October 2, 2003

    select cast(substring('021003',5,2)...

  • RE: CURSOR Replacement?

    What you want is to perform a pivot table fuction. There are some examples of doing pivot table queries on my website at http://www.geocities.com/sqlserverexamples/#pivot.

    I think you will want to do...

  • RE: Transaction Problem

    This is straight from books online, but I think this explains your issue:

    Naming multiple transactions in a series of nested transactions with a transaction name has little effect on the...

  • RE: Comparing fields that have null values.

    Comparing NULL always present problems. Think you might try something like this. Of course you will need to determine what you would like to set the "a" fields...

  • RE: Push Those Logs Away!

    Great article, and an easy step to miss if you write backups locally. We have always been shipping our logs off to another server as the last step of...

  • RE: Select date statement

    Think you want to use the convert function. Here try this:

    create table date_test (sd smalldatetime)

    insert into date_test values(getdate())

    select convert(char(10),sd,101) from date_test

    drop table date_test

    Gregory Larsen, DBA

    If you looking for SQL...

  • RE: How to suppress messages

    I'm not sure this is exactly what you are looking for, but you might try the -r option of osql.

    Gregory Larsen, DBA

    If you looking for SQL Server Examples check out...

  • RE: TOP x within group

    I'm guessing something like this might do the trick:

    select supplierid, productid,productname, unitprice

    from products a where productid in (select top 3 productid

    from Products

    where supplierid=a.supplierid

    order by SupplierID, UnitPrice desc )

    order...

  • RE: Using @@ROWCOUNT or Similar function

    This one was a new one on me as well. Think we should all say "...Prakash, a real guru ... "

    Gregory Larsen, DBA

    If you looking for SQL Server Examples...

  • RE: Using @@ROWCOUNT or Similar function

    Think of it this way:

    The update command is only updating one records at a time. First it updates there first records. After updating the first record @Hellobye gets...

  • RE: "SELECT INTO" syntax

    Since youre table only contains one records this will work:

    Declare @V1 <datatype for a, in table TblJunk)

    Declare @V2 <database for b, in table TblJunk>

    Select @v1 = a, @v2 =...

  • RE: Syntax Help

    Might try this:

    declare @delete varchar(100)

    declare @cmd varchar(100)

    set @delete = 'db_dbk.sql'

    set @cmd = 'exec master..xp_cmdshell ''del E:\backups\' + @delete + ''''

    print @cmd

    exec (@cmd)

    Gregory Larsen, DBA

    If you looking for SQL Server...

  • RE: Retrieve specific number of records from a table

    Now it make perfect sense. Your suggestion is a good one. Thank you for the answer, and the alternative method.

    Gregory Larsen, DBA

    If you looking for SQL Server Examples check...

  • RE: Retrieve specific number of records from a table

    James, I'm wondering about your statement "..maybe better.". In what cases is your suggestion better?

    I did a little test with the table I created with my earlier...

  • RE: database schema migration

    Looks like RedGate might just to the trick, and create the schema correctly.

    Gregory Larsen, DBA

    If you looking for SQL Server Examples check out my website at http://www.geocities.com/sqlserverexamples

Viewing 15 posts - 721 through 735 (of 907 total)