Forum Replies Created

Viewing 15 posts - 1,906 through 1,920 (of 3,544 total)

  • RE: DB Log File Size

    The log file contains updates to the database and will increase automatically if allowed to by database settings and it is not truncated.

    Depending on your maintenance plans you should regularly...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: select statement with Distinct and or GroupBy

    Still not sure what the exact problem is but if you only want unique masters then

    SELECT DISTINCT

    FILM_PROD_GUIDE.RECNO,

    FILM_PROD_GUIDE.ORGANIZATION,

    FILM_PROD_GUIDE.CON_FIRST,

    FILM_PROD_GUIDE.CON_PFX,

    FILM_PROD_GUIDE.CON_LAST,

    FILM_PROD_GUIDE.STREET_ONE,

    FILM_PROD_GUIDE.CITY,

    FILM_PROD_GUIDE.STATE,

    FILM_PROD_GUIDE.ZIP,

    FILM_PROD_GUIDE.PHONE_DAY

    if you include

    FILM_SUBCAT_REF.SUBNO...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Defining a default based on an Identity column

    I would think a trigger is your best bet regardless of the locks. I do this in one of my databases. You have a logic problem in your trigger, try...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Testing the order of some records

    Do you mean out of sequence as in Type is not ascending for a question?

    If so this will list the entries that are out of sequence

    SELECT a.*

    FROM @table a...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: select statement with Distinct and or GroupBy

    If you want a single row per FILM_PROD_GUDE then you will have to reduce FILM_CATEGORY and FILM_PROD_GUIDE to single rows as well (using some form of aggregation MIN, MAX etc)

    Can you...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Stripping out double quotes (") in bulk insert

    If you can guarantee the format for all records then use a format file containing :-

    8.0

    5

    1  SQLCHAR  0  1    "\""      0  Unwanted  ""

    2  SQLCHAR  0  255  "\", \""  1  Firstname ...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Hierarchical data in resultset

    OK as a function

    CREATE FUNCTION dbo.udf_test ()

    RETURNS @mytable TABLE (CategoryID int, CategoryName varchar(50), CategoryFather int, HierarchicalLevel int)

    BEGIN

    DECLARE @temp table (CategoryID int, CategoryFather int, HierarchicalLevel int)

    INSERT INTO @temp...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Hierarchical data in resultset

    oooops !!!

    just reread first post, wanted a function

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Hierarchical data in resultset

    A different approach

    CREATE TABLE #temp (CategoryID int, CategoryFather int, HierarchicalLevel int)

    INSERT INTO #temp SELECT CategoryID, CategoryFather, 0

    FROM 

    DECLARE @rowcount int

    SET @rowcount = 1

    WHILE @rowcount > 0

    BEGIN

    UPDATE...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Retrieval of records

    SELECT * FROM table1 WHERE Field1 LIKE 'Test     '

    or

    SELECT * FROM table1 WHERE Field1 = 'Test %'

    if unknown number of trailing spaces

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Using a variable as a table name when opening a cursor

    DECLARE @sql nvarchar(100)

    SET @sql = 'DECLARE c_PromoTransJoin CURSOR FOR SELECT '+@StageTable+'.LEGACY_PATRON_ID FROM '+@StageTable

    EXEC(@sql)

    OPEN c_PromoTransJoin

    ...

    CLOSE c_PromoTransJoin

    DEALLOCATE c_PromoTransJoin

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Subquery problems....

    DECLARE @Today datetime, @TodayLastYear datetime,

      @StartThisYear datetime, @StartLastYear datetime,

      @StartThisMonth datetime

    SET @Today = DATEADD(day,0,DATEDIFF(day,0,GETDATE()))

    SET @TodayLastYear = DATEADD(year,-1,@Today)

    SET @StartThisYear = DATEADD(year,DATEDIFF(year,0,GETDATE()),0)

    SET @StartLastYear = DATEADD(year,-1,@StartThisYear)

    SET...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Subquery problems....

    It is not a matter of duplicates, a sub query in a select can only return one result. Your subquery will always return multiple rows (otherwise why the GROUP BY)...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Bulk insert from inconsistent file

    bcp cannot optionally detect quotes, it can only process the data if the quotes are always present for the specific columns, so it will not work for your data

    as already...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Humble Beginnings

    My first program I wrote was in 1970 ish written in CECIL using simple commands like IN and OUT and did basic...

    Far away is close at hand in the images of elsewhere.
    Anon.

Viewing 15 posts - 1,906 through 1,920 (of 3,544 total)