Forum Replies Created

Viewing 15 posts - 286 through 300 (of 907 total)

  • RE: date format in stored procedure

    all this (DATEADD(d, DATEDIFF(d, 0, hdate), 0)) does is return the value of hdate with a time of midnight (00:00:00.000). what you want to use is something like:

    convert(char(10),[datetime],<style>) Look...

  • RE: Sorting by date and time

    If you want it for each day then you try something like this.

    select userid, max([datetime]), min([datetime]) from test group by userid, convert(char(10),[datetime])

    Gregory Larsen, DBA

    If you looking for SQL Server Examples...

  • RE: Sorting by date and time

    Try something like this:

    select userid, max([datetime]), min([datetime]) from test group by userid

    Gregory Larsen, DBA

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

  • RE: LEN(REPLICATE('X',8001))

    By unexpected results, do mean why is the length 8000, instead of 8001? If so, the max length of a character string in SQL Server is 8000 characters long,...

  • RE: finding login in stored procedure

    You might try suser_sname()

    Gregory Larsen, DBA

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

  • RE: Dynamic "USE" command?

    When you issue the "EXEC" statement it executes the USE statement outside the scope of your current session. Basically it starts a new session, executes the USE statement, then...

  • RE: Calculations with Queries

    In reality do you really want to return all rows for every day, or do you only want to return rows for the latest day. If this is the...

  • RE: Changing tables

    If you make design changes in EM it will copy the date out, and back for you.

    Gregory Larsen, DBA

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

  • RE: Calculations with Queries

    You might try something like this:

    SET DATEFORMAT DMY

    CREATE TABLE ABC ([DATE] DATETIME, TABLENAME CHAR(10), NOOFRECORDS INT)

    INSERT INTO ABC VALUES ('23-04-2003','TABLEA',10)

    INSERT INTO ABC VALUES ('23-04-2003','TABLEB',50)

    INSERT INTO ABC VALUES ('24-04-2003','TABLEA',15)

    INSERT INTO ABC...

  • RE: Init caps

    You might try this UDF:

    This script came from: Angela But -- abut@rdns.com.au

    CREATE FUNCTION fnTitleCase (@instring nvarchar(256))

    RETURNS nvarchar(256)

    AS

    --This function will evaluate an input string and convert it to title-case format.

    -- It...

  • RE: Log files location change

    Here is a good knowledge article on the subject. Of course they say use detach/attach. You can do a database backup and restore with move option as well.

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

    Gregory...

  • RE: substring

    Here is a function that should give you what you want. Just to give credit where credit is due, I got this script from: Angela But -- abut@rdns.com.au

    CREATE FUNCTION fnTitleCase...

  • RE: Using Left or Contains

    You might try the CASE statement and the CHARINDEX function like so:

    declare @X varchar(100)

    declare @Y varchar(100)

    set @X = 'Testing.Test'

    set @Y = 'ABCDETest Test2'

    select case when charindex('.',@X) > 0

    ...

  • RE: archive the table

    Depends on what you mean by archive. SQL Server has no archive function. But you could copy the data from a table to a flat file using DTS,...

  • RE: CDONTS / CDOSYS

    Thank you for the reply. I'll check out these articles. Seems like moving to CDOSYS is probably the right move.

    Gregory Larsen, DBA

    If you looking for SQL Server Examples...

Viewing 15 posts - 286 through 300 (of 907 total)