Forum Replies Created

Viewing 15 posts - 2,416 through 2,430 (of 2,894 total)

  • RE: I need a better way to do this

    DataDog (8/12/2010)


    create some helper functions:

    public static string SqlName(string name) {

    return "[" + name.Replace("]", "]]") + "]";

    }//method

    public static string SqlString(string name) {

    return "'" + name.Replace("'", "''") + "'";

    }//method

    if you're...

  • RE: Help In Writing the query

    Raghavender (8/11/2010)


    Hi All,

    I am developing a report, In which I need to select creditors group either single one or all creditors gorups, can you please let me know how to...

  • RE: how to unescape

    You can do this:

    declare @T table

    (col1 int,

    col3 char(3))

    insert into @T

    select 1, '<A>' union all

    select 1, '<B>' union all

    select 1, '<C>' union all

    select 1, '<D>' union all

    select 2, '<E>' union all

    select...

  • RE: I need a better way to do this

    Sorry mate, no one said that your solution need 1000+ stored procedures and 400+ views and 350+ temporary tables. Actuallty, no one here in position to advise about these numbers...

  • RE: I need a better way to do this

    dennisv (8/11/2010)


    ...

    I don't write SQL enough to get good at it...

    ...

    No offence, but do you seriously believe that writing "enough" in C# makes you good in it? 😉

    Hornestly, before advising...

  • RE: Performance Tuning 40,000,000

    Add non-clustered index on mf_cd in mj_reg_stats table!

    If you check the current query plan, I believe you will see index scan there. Adding the above index together with the index...

  • RE: Performance Tuning 40,000,000

    When last time statistic was updated on the tables?

    UPDATE STATISTICS table_or_indexed_view_name

  • RE: Performance Tuning 40,000,000

    Do you have an index on mf_cd in mj..stat_type?

    You can try using "OPTION (MAXDOP 1)" and see if you have any performance gain (just add it at the end...

  • RE: Performance Tuning 40,000,000

    1. Use ANSI joins: "FROM T1, T2 WHERE ..." should be changed to

    "FROM T1 JOIN T2 ON ..."

    2. Do insert in batches. Try 2,000,000 rows at the time. You...

  • RE: Export to excel errors

    What crashes with the mentioned error? Why you think that it's related to COPY?

    The error clearly says that it cannot find object 'DATA$' - there is nothing bout COPY. Do...

  • RE: Export to excel errors

    Change to:

    SET @SQL=N'INSERT INTO OPENROWSET(''Microsoft.Jet.OLEDB.4.0'',''Excel 8.0;DATABASE='+@xlFileName+''',''Select * from [DATA$]'')SELECT COMPANY,LOANREF,AGREEMENTNUMBER,SOLREF,FIRSTNAME,SURNAME,ADD1,ADD2,ADD3,POSTCODE,CAPITAL,INTEREST,FEES,BALANCE,STARTDATE,DUEDATE,LOANTYPE FROM TBL_STATEMENTS where PRACID = ' + CAST(@PRACID as varchar(11)) + ';'

    As you had it before, @PRACID would be local...

  • RE: Changing Non-ANSI Standard JOINS to ANSI Standards

    Hard to say about all SQLServer versions...

    In SQL2008 setting compatibility level to 80, allows to execute queries with non-ANSI joins and the result of your query is the same as...

  • RE: Help on Table/Query tuning

    sudhanva (8/11/2010)


    GilaMonster (8/11/2010)


    Post the view definition?

    CREATE VIEW [View1]

    AS

    SELECT ROW_NUMBER() OVER (ORDER BY VERSIONID) AS ROW_NUMBER,* FROM

    (SELECT Col1, Col2, Col3, Col4, Col5, Col6, Col7, Col8, [value]

    from Table1

    WHERE PARAMETERNAME in (SELECT...

  • RE: Export to excel errors

    Your sql statement is incomplete:

    INSERT INTO OPENROWSET('Microsoft.Jet.OLEDB.4.0','Excel 8.0;DATABASE=D:\Eatons.XLS','Select * from [DATA$]')

    Insert what? Have you looked into syntax of statement you are using?

    Google usually helps...

    It should look something like:

    insert into...

Viewing 15 posts - 2,416 through 2,430 (of 2,894 total)