Forum Replies Created

Viewing 15 posts - 16 through 30 (of 49 total)

  • RE: Import all csv files in a directory without hard coding the file name

    I thought you were going to use the date in the filename - if not then I can't think of a way without using xp_cmdshell in which case you could...

  • RE: Import all csv files in a directory without hard coding the file name

    I've often done this using the following code.

    create table #data_extract_files

    (

    filename varchar(20),

    depth tinyint,

    fileorfolder tinyint

    )

    insert into #data_extract_files

    exec master..xp_dirtree 'C:\data_extracts\',1,1

    Hope this helps!

    Simon 🙂

  • RE: Period-to-date table

    Another approach would be to create your FiscalDates table with every date in it:

    CREATE TABLE FiscalDates

    (

    [Id] INT IDENTITY(1,1),

    [Date] DATETIME PRIMARY KEY,

    [WeekNumber] INT,

    [PeriodNumber] INT,

    [Quarter] INT,

    [FiscalYear] INT

    )

    This would allow you to quickly...

  • RE: Period-to-date table

    Are you in a position to change the structure of your dates table?

    What will happen when you go into a new fiscal year - will you replace the LAST_YEAR_WEEK_DATE with...

  • RE: JOINS with COALESCE

    Based on your sample data, this would work, but it relies on #DEF.anotherid being unique and inserted into the table in numerical order - it's not a particularly nice piece...

  • RE: datetime => how to have complete date with 00:00:00.000

    One way I often do this:

    CREATE TABLE #MyTable

    (

    MyDate DATETIME

    )

    INSERT INTO #MyTable

    SELECT '2008-10-28 11:04:04.207' UNION ALL

    SELECT '2009-03-30 13:26:10.433' UNION ALL

    SELECT '2009-01-16 14:06:20.033'

    SELECT MyDate,

    DATEADD(dd, DATEDIFF(dd, 0, MyDate), 0) MyDate_DateOnly

    FROM #MyTable

    DROP TABLE #MyTable

    Hope...

  • RE: How to create this kind of Trigger?

    Damien (9/3/2009)


    I'm starting to read online books regarding trigger.

    Just to clarify, when people recommend you read Books Online (often shortened to BOL), they usually refer to the documentation of...

  • RE: Alternative to variables for a View

    Did you read the article Gail Shaw (GilaMonster) linked in reply to your other post - you'll get a much stronger response and far greater help if you follow its...

  • RE: Normalising data in semicolon-delimited format

    Thankyou Jeff, I was having real trouble trying to think of a way to work the question number off the number of preceding semi-colons in the string - hadn't...

  • RE: SQL Profiler: How do I see the value of a parameter?

    Unless I'm missing something, couldn't you look for the call to the stored procedure in Profiler by capturing TSQL > SQL:BatchCompleted ? In my setup that's one of the...

  • RE: Normalising data in semicolon-delimited format

    Hi Jack,

    I'm getting different result sets when I run your query and my query.

    Just to clarify, for each question of a survey, I want to split the answers out into...

  • RE: Please Help me Very Urgent

    Is "accounts" a table or a view, and does it have any computed columns in it?

  • RE: Intra-query parallelism

    Just a small (but significant :-P) correction to the above post:

    sp_configure 'max degree of parallelism', 1

    This issue appears in certain conditions (I've only seen it happening with certain statements using...

  • RE: Automatically change LOWER to UPPER

    If it has to be done server-side then I would go with the trigger approach as well but remember to handle updates to the column as well if necessary.

  • RE: CHECK CONSTRAINT + Which doctor is good to check?

    Your departments table will allow the following:

    insert into departments values ('12')

    I'm guessing you only want it to allow uppercase characters A-Z?

Viewing 15 posts - 16 through 30 (of 49 total)