Forum Replies Created

Viewing 15 posts - 61 through 75 (of 119 total)

  • RE: Remove Leading Zeros

    assuming if all values in your column is numeric in value only, then you can cast that column as an integer data type. See below for example:

    SET NOCOUNT ON

    DECLARE...

  • RE: Best way of getting Avg Date?

    I can also think of:

    SET NOCOUNT ON

    DECLARE @tt TABLE (THE_DATE SMALLDATETIME)

    DECLARE @current_date SMALLDATETIME

    SET @current_date = CONVERT(SMALLDATETIME, CONVERT(VARCHAR(10), GETDATE(), 101), 101)

    INSERT INTO @tt VALUES('1/1/2003');

    INSERT INTO

  • RE: Best way of getting Avg Date?

    hmmm.. good question.

    The type which the AVG() aggregate function used to generate summary values in query resultset.

    I tried SELECT AVG(THE_DATE) FROM @tt but it returns the following error...

  • RE: How to suppress this "warning" message?

    Thanks!

    However, I decide that it is better to put the ISNULL in the code rather than suppress the message. Is it possible to monitor this warning message from SQL Profiler?

    Thanks...

  • RE: Why does the Transaction Log keep growing?

    Dan:

    Thanks for the tip. Using dbcc opentran, there was one stray open transaction. It makes sense now!

    Billy

  • RE: BACKUP to tape failed

    What kind of a backup are you trying when you are in SIMPLE recovery mode? When you are in SIMPLE recovery mode, you can only do complete or differential...

  • RE: Log file backups bringing down SQL

    I would check the SQL Server log and the Event Viewer for any suspicious or valuable information that may explain why SQL Server is going down when you backup log...

  • RE: #table vs @table which is better

    Be careful here. Table vars do not work exactly the same as temp vars. For example, you cannot use exec as source when inserting into table var.

    That is,...

  • RE: Column name lookup

    Using...

    Select * from information_schema.columns

    where table_name = 'my_table'

    ...should give you the column names of the table you want to query column names for. Then put a WHERE clause in your...

  • RE: Check contraint

    There is probably a better way but the following works...

    USE TEMPDB

    BEGIN TRAN

    GO

    CREATE TABLE MY_TABLE(

    THE_VALUE_A CHAR(1),

    THE_VALUE_B CHAR(1),

    CONSTRAINT CHK_A_AND_B CHECK(

    ...

  • RE: Am I crazy?

    do you mean "where 2 <=" ....

  • RE: Text Function Help

    Thanks David and Jay.. I am looking for the best way to address the worst case scenario (ie. huge number of records and text chars are greater than 8000).... I...

  • RE: Wht's wrong with this sql statement. Does not run

    SQL Server is looking for the recordvoidsale column before it is added. Instead, try ....

    if not exists(SELECT * FROM [HISPos].[dbo].[syscolumns]

    where name='RecordVoidSale')

    begin

    alter table HISPOSControl add RecordVoidSale bit default 0

    exec ('update...

  • RE: nth row

    No sorting allowed?? ok, then, how about loading the table into a temp table with an identity column and sorting it based on newly created identity column.

    Try....

    use northwind

    DECLARE @tempTable TABLE(THE_ID...

  • RE: Help with SQL Statement (is it possible)

    Hi Jay:

    I thought that you were trying to say that this report should NOT be done with relational programming style. However, just rereading your message it appears I am...

Viewing 15 posts - 61 through 75 (of 119 total)