Forum Replies Created

Viewing 15 posts - 4,186 through 4,200 (of 7,613 total)

  • RE: Searching set of words by ignoring spaces

    Rather than literal strings of spaces, I recommend using SPACE(), just for readability:

    /*CREATE FUNCTION ...*/

    SELECT REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(LTRIM(RTRIM(@Text)),

    SPACE(33), ' '),

    SPACE(17), ' '),

    SPACE(9),...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: Insert Into multiple values from Select plus adding incremental non-Identity

    INSERT INTO dbo.TableA

    ( Sequence, Title, Signature, IsDefault, UserName )

    SELECT A_Last.Sequence + B.row_num, A.Title, A.Signature, 'Y' AS IsDefault, B.UserName

    FROM (

    SELECT B2.*, ROW_NUMBER() OVER(ORDER BY B2.UserName) AS row_num

    ...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: Do Not Return Matching Rows

    --

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: LOB data types

    GilaMonster (8/24/2016)


    Filestream isn't a datatype. It's an attribute of a varbinary data type column. Bigint is definitely not considered as large object, it's a grand total of 16-bytes in size.

    Your...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: @@ROWCOUNT when cascade delete?

    Afaik, there is no way to get that number back from SQL. In theory, SQL could have had to cascade thru a dozen tables (or more).

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: sp_executesql and howto return rowcount

    I give up. You keep randomly changing things. And this message:

    "The variable name '%.*ls' has already been declared. Variable names must be unique within a query batch or...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: sp_executesql and howto return rowcount

    SET @SQLstmt =

    N'DECLARE @RCount int ' +

    ' SELECT [LCPRBSELF]' +

    ' FROM [' + @rowDSServer+ ']' + '.'

    + '['...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: Sql script to check that each patient has both a diastolic and a systolic blood pressure for each given service date

    DOH, sorry, typo on my part. Should be:

    values('DP'),('SP')

    [rather than values('DP','SP')]

    Edit: added bold to the parens I added to highlight them better.

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: WHERE clause problem comparing 2 float values

    Floating point values are only approximate values rather than exact values. If you need to make an equals comparison, you need to use decimal values.

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: sp_executesql and howto return rowcount

    Your variable in the code is named @Rcount. You need to use that name in the @params clause:

    EXEC sys.sp_executesql @stmt = @SQLstmt

    , @params = N'@Rcount INT OUTPUT'

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: Sql script to check that each patient has both a diastolic and a systolic blood pressure for each given service date

    select MBR_LAST_NAME, MBR_FIRST_NAME, BIRTH_DT, SERVICE_DT,

    SERVICE_TYPE_CD, case when SERVICE_TYPE_CD = 'DP' then DP ELSE SP END AS BLOOD_PRESSURE

    from (

    select MBR_LAST_NAME, MBR_FIRST_NAME, BIRTH_DT, SERVICE_DT,...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: Sql script to check that each patient has both a diastolic and a systolic blood pressure for each given service date

    select MBR_LAST_NAME, MBR_FIRST_NAME, BIRTH_DT, SERVICE_DT,

    MAX(case when SERVICE_TYPE_CD = 'DP' then <value> end) AS DP,

    MAX(case when SERVICE_TYPE_CD = 'SP' then <value> end)...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: Indexes

    Those are excellent points. Thus, the other rule you should follow when creating indexes is to always explicitly specify CLUSTERED or NONCLUSTERED. Again, clustering is far too critical...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: Linked server query merging remote data with local - deadlock victim

    To avoid pulling the entire remote table columns over every time the query runs, you need to add an index to the remote table that will identify rows updated or...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: Indexes

    1) No. The primary key and clustering key are not necessarily directly related. The clustering index is the single most critical factor for performance. And it should...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

Viewing 15 posts - 4,186 through 4,200 (of 7,613 total)