Forum Replies Created

Viewing 15 posts - 241 through 255 (of 907 total)

  • RE: how to use time functions in sql server?

    ok try something like this:

    create table t(d datetime)

    insert into t values('2002-01-01 14:15:02')

    insert into t values('2002-01-01 15:15:02')

    select * from t where

    abs(datediff(mi,cast('1900-01-01 '+substring(convert(char(19),d,120),12,19) as datetime),

    cast('1900-01-01 '+substring(convert(char(19),getdate(),120),12,19) as datetime))) <=30

    Gregory Larsen, DBA

    If...

  • RE: how to use time functions in sql server?

    Forgot a ) probably should have been "and" instead of "or".

    dateadd(mi,30,getdate()) <= field

    and

    dateadd(mi,-30,getdate()) >= field

    Gregory Larsen, DBA

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

  • RE: how to use time functions in sql server?

    dateadd(mi,30,getdate()) <= field

    or

    dateadd(mi,-30,getdate() >= field

    Gregory Larsen, DBA

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

  • RE: Moving transactions logs

    You can use sp_detach/sp_attach. Read more about it in the KB article:

    http://support.microsoft.com/default.aspx?scid=kb;en-us;224071

    Gregory Larsen, DBA

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

  • RE: select clause into string variable

    try something like:

    declare @foo varchar(8000)

    select @foo=cast(description as varchar(8000)) from categories where categoryid=1

    print @foo

    Gregory Larsen, DBA

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

  • RE: Stored Procedures - OUTPUT?

    You might try something like this. This is how to return variables to calling program from dynamic SQL.

    set nocount on

    create table foobar (id int, theid int)

    insert into foobar values(1,1)

    insert...

  • RE: displaying decimal values in QA

    You can also do this to force decimal division:

    select 1000.0 / 34.0

    or something like this is you want to round:

    select cast(1000.0 / 34.0 as decimal(10,3))

    Gregory Larsen, DBA

    If you looking...

  • RE: DBSize

    I wrote an article for SQL Server Magazine that outlined a process to do that. The process gather used and unused space stats and kept them in a database, for...

  • RE: concatenating a surrogate table

    not sure this suits you needs but you might try something like this:

    use pubs

    Create Table Trip(

    SeqNum int

    ,Product varchar (50)

    ,Van varchar(50)

    ,Driver varchar(50)

    )

    Create table ConsignmentCalls(

    ForeignSeq int

    ,Location varchar( 50 )

    )

    insert into Trip

    Select 123,...

  • RE: Need a good Internet Mail Server

    Ok next week I'm planning on sitting down and reviewing each of these mail servers recommended. Not that I want to review any more, but if there are others...

  • RE: xp_sendmail

    Logon to the server, bring up OUTLOOK, and check to make sure the "Save copies of Sent Message" is checked under the Properties menu when sending mail.

    Gregory Larsen, DBA

    If you...

  • RE: Cursor the only option ?

    Here is a way to do it without a cursor, although maybe this is not much better.

    -- create tables

    CREATE TABLE qualifications(ClientID int, Qualifications varchar(20))

    Create table Client (ClientID int,ClientName varchar(20))

    -- populate...

  • RE: Multiple row/value updates

    Or you can do just this:

    Update tableA Set TableA.Value2 = TableB.Value2 from TableB where TableA.Value1 = TableB.Value1

    Gregory Larsen, DBA

    If you looking for SQL Server Examples check out my website at...

  • RE: Need a good Internet Mail Server

    Hummm.......Wonder if I can sell the Windows Server 2003 option?.........Don't know.......

    Gregory Larsen, DBA

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

  • RE: Simple T-Sql that's driving me nuts!

    I'm not sure I understand exactly what you want.

    Do you want to return on one record for each distinct value of c1? Meaning either one of these...

Viewing 15 posts - 241 through 255 (of 907 total)