Forum Replies Created

Viewing 15 posts - 6,121 through 6,135 (of 7,191 total)

  • RE: Data Grouping

    I'm sorry, but I still can't work out what you're trying to do. Please will you describe in words what your query should achieve?

    Thanks

    John

  • RE: Data Grouping

    No, not unless you give us some more information. Please post DLL in the form of CREATE TABLE scripts, sample data in the form of INSERT scripts, a brief...

  • RE: Avoid repetitive code with ISNULL

    Then I think your original code should be OK. But check the execution plan to see whether it is using any index that you expect it to, and if...

  • RE: Avoid repetitive code with ISNULL

    So you're only testing for the NULLness of @Param1 and @Param2? That doesn't relate to the columns at all, and so you're either going to get all the rows...

  • RE: Avoid repetitive code with ISNULL

    A function will only stop an index being used if it's applied to the column, not a parameter or constant.

    John

  • RE: trouble with query.details inside post

    Assuming the only two values allowed in the type column are CRT and DBT, something like this:

    SELECT InvoiceNumber, MAX(type), MIN(type)

    FROM MyTable

    GROUP BY InvoiceNumber

    HAVING MAX(type) > MIN(type)

    John

  • RE: UDF to create a counter

    Debra

    If you don't have more than one update in any particualr second, you could do something like this:

    select datediff(s,'01 Jan 1980',getdate())

    If your updates are more frequent than that, you could...

  • RE: UDF to create a counter

    Debra

    Have you tried NEWID()?

    John

  • RE: UDF to create a counter

    Debra

    I think the simplest way to achieve what you want is with an identity column. If this is a new table, add the identity column before you insert any...

  • RE: Script logins of stored proc

    Yes, there is. Look up the sys.database_permissions metadata view.

    John

  • RE: How would you code this using t-sql?

    If EXCEPT works for you, then go with it, although I don't think you need to waste time concatenating into a single column - just specify both in the query...

  • RE: sp_MSforeachtable

    What happens if you try to assign permissions to individual tables? Choose a table and execute this:

    GRANT SELECT ON dbo.MyTable to NPQuiggin

    John

  • RE: sp_MSforeachtable

    Nigel

    According to Books Online:

    The names of users that are mapped to SQL Server logins, certificates, or asymmetric keys cannot contain the backslash character (\).

    What is the actual name of the...

  • RE: How would you code this using t-sql?

    Shouldn't be too complicated... what have you tried so far? What I'd do is use a LEFT JOIN to identify which records are to be deleted, and a RIGHT...

  • RE: Is there any way that we can revert/rollback after updating data ?

    OK, I don't think you can just back that query out. So what you need to do is restore to a different database, then do something like this:

    UPDATE d

    SET...

Viewing 15 posts - 6,121 through 6,135 (of 7,191 total)