Forum Replies Created

Viewing 15 posts - 481 through 495 (of 1,162 total)

  • RE: Multiple count() in a single SQL

    SELECT COUNT(*) AS Total,

    COUNT(CASE WHEN igroup=1 THEN 1 END) AS group1,

    COUNT(CASE WHEN igroup=2 THEN 1 END) AS group2,

    COUNT(CASE WHEN igroup=3 THEN 1 END) AS group3,

    COUNT(CASE WHEN igroup=4 THEN 1...

  • RE: exporting xml

    I'm sure you can do this in a text file with the correct delimiters, but I'd avoid flat files entirely and use SSIS to move the data directly from one...

  • RE: SQL injection attack

    There is a wealth of information on Google on how to protect against SQL Injection. The main points are:

    Always parameterise your inputs into SQL Server (e.g. use parameterised stored procedures...

  • RE: central attachment/file table

    I'd go for CustomerAttachment, EmployeeAttachment and ProjectAttachment tables with FK's back to the attachment table and the relevant entity...

  • RE: Are the posted questions getting worse?

    mtillman-921105 (3/5/2012)


    I was thinking it must be Teriyaki chicken, but it was not to be... :w00t:

    That's Japanese! Entirely different cuisine 🙂

    I've had good pigs trotters before in...

  • RE: Alert Message - popup window

    Divine Flame (3/5/2012)


    ???

    It's a spam bot. Reported

  • RE: script

    You could easily build your own backup script and use the sys.databases system view to filter out names as required.

    Or, you could use something like Ola's backup scripts which support...

  • RE: Extracting a value stored in Byte 1 of a 32-bit (int) status field

    Is it just as simple as this:

    declare @device_status_flag int=-539042045

    SELECT SUBSTRING(CAST(@device_status_flag AS BINARY(4)),2,1)

    This result could obviously be cast back to an int if required.

  • RE: xp_deletefile on linked server problem

    I haven't got a 2000 instance to hand, but shouldn't it be master.dbo.xp_delete_file?

  • RE: Optimize Query with Highest Cost

    If you're using SQL 2008 SP2 onwards, you can change the select to:

    SELECT

    LEVEL4_CODE,

    LEVEL4_NAME,

    LEVEL5_CODE,

    LEVEL5_NAME,

    LEVEL6_CODE,

    LEVEL6_NAME,

    product_Name,

    package_Name,

    product_code,

    package_code,

    borrower_no,

    Due_Date,

    RECEIPT_DATE,

    RecPA,

    Recsc,

    Reclsc,

    RecPenalty,

    Rebate

    FROM dbo.CR_RecoveryReceiptWise_Rpt(@DisbursementDateFrom,@DisbursementDateTo,@ReportingDate,@PRODUCTCODE,@PackageCode,@PurposeCode,@DonorCode,@ProjectCode,@MemberCode,@LoanApplyDate,@LoanStatus,@RepaymentMode,@RepaymentPeriod,@BorrowerNo,@SanctionNo,@PhasePLA,@PovertyRank,@Gender,@CNIC,@CoCode,@CoType,@CoStatus,@OfficeCodes) OPTION(RECOMPILE)

    This will then use the new optimisations for static...

  • RE: poor performance running select on non indexed views

    Mark Thornton (2/28/2012)


    ok...just an update on this. The sql 2000 server had 8 processors where the 2008 server had only 2. We bumped that up to 4 and...

  • RE: Is there a way to connect to two databases on different servers *without* using a Linked Server?

    You can easily use SSIS to pull directly from one data source to another without having to put it on disk first.

    The easiest way to do this is to create...

  • RE: poor performance running select on non indexed views

    If you have upgraded from SQL 2000, firstly check that you've specifically updated statistics WITH FULLSCAN.

    Other than that, you may be hitting an edge case where SQL 2000 actually came...

  • RE: WHERE Date Range

    Sorry, I guess what I meant was the problems associated with Parameter Sniffing rather than strictly Parameter Sniffing. Obviously in your 3rd example, if you changed the parameter value to...

  • RE: WHERE Date Range

    GilaMonster (2/27/2012)


    HowardW (2/27/2012)


    Presumably, the one exception to this is the OPTION(RECOMPILE) optimisation in 2k8 SP2 onwards in that it forces it not to parameterise?

    That's still parameterised (well, depends on...

Viewing 15 posts - 481 through 495 (of 1,162 total)