Forum Replies Created

Viewing 15 posts - 106 through 120 (of 268 total)

  • RE: Create unique user name from first and last name

    Elaborating...

    USE Northwind

    select LastName + FirstName + convert(varchar(36),newid()) from Employees -- Very Unique

    select binary_checksum(LastName,FirstName) from Employees-- Case sensitive

    select checksum(LastName,FirstName) from Employees-- Case insensitive

    /rockmoose

  • RE: Stored Procedure Polymorphism ??

    Nice mwelcome!

    So now I have to go back and check execution plans etc to find which of these approaches is the most efficient....

    /rockmoose

  • RE: Order By Select In

    SELECT * FROM mytable WHERE Id IN (1,3,2,4)

    ORDER BY CASE Id WHEN 1 THEN 1 WHEN 3 THEN 2 WHEN 2 THEN 3 WHEN 4 THEN 4 ELSE 0X7FFFFFFF END

    ..by...

  • RE: convert float to string

    This was a challenge...

    Couldn't find many ways to do it better :-).

    But this is shorter ;-), and will round the float value correctly:

    declare @projectcost float

    set @projectcost = 6842332198.523549

    -- shorter version...

  • RE: Trigger blues...

    Good day,

    I would suggest using a computed column IOF trigger ... 🙂

    Like so (copying noelds sample ):

    The CAST is just to get the bit datatype for the computed column.

    CREATE TABLE...

  • RE: Stored Procedure Polymorphism ??

    Good J..P..

    Sometimes I have implemented something like this:

    SELECT ServerName, Environment, ServerRole FROM V_ServerDetail

     WHERE ServerName = ISNULL( @ServerName, ServerName )

     ORDER BY ServerName

    But your solution is better since it works for NULL...

  • RE: running dts

    /************* Run DTS Package **************/

    declare @package_name varchar(128)

    declare @cmd varchar(255)

    set @package_name = 'MyNiceDtsPackage'

    set @cmd = 'dtsrun /S SERVERNAME /E /N ' + @package_name

    execute master..xp_cmdshell @cmd --, no_output

    /******************************************/

    Lookup xp_cmdshell and dtsrun in BOL...

  • RE: UniqueIdentifier Conondrum

    What are the other Unique Indexes / Primary Key on the table ?

    Use that to retrieve the last newid() in the table.

    Using ONLY a Uniqueidentifier as Key in the table...

  • RE: Finding SQL in data dictionary

    Yup,

    If you come across a better solution please notify me

    Profiler is a great help...

  • RE: Finding SQL in data dictionary

    Hi,

    You could use: DBCC INPUTBUFFER(pid),

    Ok, will only get first 255 chars of the statement...

    /rockmoose

  • RE: Uer defined function return value

    Recently there was a discussion on a similar / related problem here:

    http://www.sqlservercentral.com/forums/shwmessage.aspx?forumid=8&messageid=122554#bm124279

    /rockmoose

  • RE: Excessive Login Failures

    As if you already didn't have this one bookmarked

    http://www.sqlsecurity.com/

    /rockmoose

  • RE: MDX: Dynamic filtering of date dimension

    Maybe it is something simpler that is needed:

    SELECT NON EMPTY

    {[Call Date].[20031102]:[Call Date].[20031104]} ON COLUMNS,

    CROSSJOIN({[Region Customers].[Region].Members},{[User IDs].Members}) ON ROWS

    FROM [Billed Call Detail]

    Is this what You are trying to accomplish ?:

    SELECT NON...

  • RE: How can I export a DB data into a delimited format?

    For Exporting data, Do I need special tools? (If so name me some) - I need to transfer the data from one application to another

    One springs to mind: bcp (...

  • RE: Deleting with a Foreign Key

    Maybe You could split the problem somehow.

    DECLARE @ToBeDeleted TABLE( Id int not null primary key clustered&nbsp

    INSERT @ToBeDeleted( Id )

    SELECT ... Query to Resolve the...

Viewing 15 posts - 106 through 120 (of 268 total)