Forum Replies Created

Viewing 15 posts - 16 through 30 (of 98 total)

  • RE: ADD CARRIAGE RETURN IN A VARCHAR

    Try something like this...

    DECLARE @Data varchar(50)

    DECLARE @Value int

    DECLARE @Count int

    DECLARE @val varchar(16)

    SET @Data = 'THIS IS A TEXT MESSATE SORRY IT IS A MESSAGE'

    SET @Value...

  • RE: Get the DB Owner through T-SQL

    george sibbald (6/3/2009)


    This gives the owner of the database

    select suser_sname(sid),name from master..sysdatabases

    just add the relevant where clause for a particular database

    Retrieving who originally created the database (if different) I...

  • RE: Get the DB Owner through T-SQL

    MarkusB,

    Is it possible to achieve this through sql statement? Like sys.databases some thing like ....

    ---

  • RE: Get the DB Owner through T-SQL

    Thanks you very much MarkusB for your quick info. 🙂

  • RE: To get the date according to my parameter value

    DECLARE @ExpDate int

    DECLARE @CurrentDate NVARCHAR(180)

    DECLARE @TimeElapsed NVARCHAR(180) -- 'hh:mm'

    DECLARE @RemainingTime NVARCHAR(180)

    SET @ExpDate = 13

    SET @TimeElapsed = '06:00' -- 'hh:mm'

    SET @CurrentDate = '2009-04-14 10:00:00.000'

    SELECT @RemainingTime = -- Some Logic

    My Result

    ---------

    The result...

  • RE: Remove the rows if result set shows NULL value

    San (4/2/2009)


    You can try the below query as well.....There will be a better way...will check and revert back..

    SELECT * FROM

    (

    SELECT

    CASE WHEN (Row_Number() OVER (ORDER BY Q.QText)) > 1...

  • RE: Dynamic value as an alias name

    it works.

    thanks mangal.

  • RE: Make a primary key column as identity?

    Thanks All for your valuable reply.

    Yes Andrew, i have done that through dropping the foreign key and recreating the same.

    But i am still doing, is there any other way...

  • RE: Make a primary key column as identity?

    Andrew Reilly (2/4/2009)


    Just go into management studio into the table design and set the Identity Specification and it should work just fine

    😛 That i know. How can i achieve through...

  • RE: Maintenance Plan is not working as expected.

    Hi,

    I got my it is happened. here i changed my sa password for my server.

    When i right click and say create to ==> it shows me the old sa...

  • RE: Kill the "RUNNABLE" Status Process

    vikas bindra (1/22/2009)


    I had faced the same issue twice or thrice on my test server. That time I just restarted the SQL server service 🙂 (as it was a test...

  • RE: Dependancy Problem when creating a new DB

    vikas bindra (1/15/2009)


    Yes you can get away with these warnings. You will have to identity the objects that are generating these errors (as in the example AddEmployee SP) and then...

  • RE: Dependancy Problem when creating a new DB

    Thanks Vikas, RBarry for your quick reply.

    I can understand now.

    But is it possible to knock off that warning message also?

    Because we are getting nearly 10 to 15 warning messages...

  • RE: Handling ISNULL in xml Parser

    Thanks Jack for your valuable reply.

    Here i was using NULLIF function. Using this i got the result. Please see the below code.

    SELECT SCOPE_IDENTITY(),

    ISNULL(NULLIF(Ques.value('Option1[1]','varchar(16)'),''),NULL) AS Option1,

    ...

  • RE: CTE returns NULL value.

    DECLARE @HieLevel TABLE

    (

    HieID[uniqueidentifier],

    HieLevel[tinyint],

    ParentHieID[uniqueidentifier],

    Levels[tinyint]

    )

    ;WITH CTEHierLevel(fldHieID,fldHieLevel,fldParentHieID,Level)

    AS

    (

    SELECT

    fldHieID,

    fldHieLevel,

    fldParentHieID,

    0 AS Level

    FROM

    tblHierachey

    WHERE

    fldHieID = @HieID

    UNION ALL

    SELECT

    Client.fldHieID,

    Client.fldHieLevel,

    Client.fldParentHieID,

    Level + 1

    FROM

    tblHierachey AS Client

    INNER JOIN

    CTEHieLevel AS CL

    ON (Client.fldParentHieID = CL.fldHieID)

    )

    INSERT INTO @HierLevel (HieID,HieLevel,ParentHieID,Levels)

    SELECT fldHieID,fldHieLevel,fldParentHieID,Level FROM CTEHierLevel order by level

    /* Below...

Viewing 15 posts - 16 through 30 (of 98 total)