Forum Replies Created

Viewing 15 posts - 1,081 through 1,095 (of 2,007 total)

  • RE: execute string

    BEGIN TRAN

    CREATE TABLE yourTable (yourTableID INT IDENTITY, column1 VARCHAR(500), column2 VARCHAR(500))

    INSERT INTO yourTable (column1)

    SELECT '2 * 2+1 * 7'

    UNION ALL SELECT '1 * 1+2 * 4'

    UNION ALL SELECT '1 *...

  • RE: How many databases on one single instance

    Theoretically, you could have 32,767 databases per instance.

    Good luck with that. . . Personally, I find it difficult to keep track of more than 10.

  • RE: Need Help

    nawaz1774 (1/9/2012)


    Thats exactly I am looking for I need a lot different questions to practice. I just donno where to find them.

    I'm just reiterating the opinions already posted; answer other...

  • RE: HOW TO FIND A VALUE IN ALL COLUMN OF ALL TABLE IN A db.

    Untested, but something like this should work

    BEGIN TRAN

    DECLARE @sql AS VARCHAR(MAX)

    SELECT @sql = COALESCE(@SQL,'') + 'SELECT ' + c.name + ', '''+c.name+''' AS columnName FROM ' + o.name + '...

  • RE: Searching across multiple fields within a table?

    mick burden (1/9/2012)


    Many thanks, I've tried your solutions and the first dynamic version from Cadavre works despite the fact syscolumns is in the query, when I substitute this with sys.columns...

  • RE: Searching across multiple fields within a table?

    mick burden (1/9/2012)


    There is one more question regarding this, is there a way this can be achieved without specifying the column names (other than the date field) as I may...

  • RE: how to convert multiple rows into (separte) columns in one row?

    fahey.jonathan (1/9/2012)


    Another possible way to accomplish what you need is to use subqueries to get the parts and left join them to the main table:

    SELECT e.emp_id, e.emp_name, e.join_date,

    ...

  • RE: Searching across multiple fields within a table?

    mick burden (1/9/2012)


    Thank you so much for getting back to me so fast.I've googled your suggestion but can't see how that can help.

    BEGIN TRAN

    --Sample data

    CREATE TABLE yourTable ([date] DATE, Jim...

  • RE: date & time extraction

    BEGIN TRAN

    --1,000,000 Random(-ish) rows of data

    SELECT TOP 1000000 IDENTITY(INT,1,1) AS ID,

    CONVERT(DATE,RAND(CHECKSUM(NEWID())) * 30000 + CAST('1945' AS DATETIME)) AS randomDate

    INTO #testEnvironment

    FROM master.dbo.syscolumns sc1, master.dbo.syscolumns sc2, master.dbo.syscolumns sc3

    --Query the table

    SELECT TOP...

  • RE: Select two Level Data from Multiple tables

    The tables as you've laid them out are badly designed and incorrect.

    I've corrected the issue, but not the bad design : -

    CREATE TABLE role(

    [roleID] INT IDENTITY,

    [applicationname] [nvarchar](256) ,

    [rolename] [nvarchar](256))

    INSERT INTO...

  • RE: Combine different periods into one

    This should get you on the right sort of track. Bear in mind that I've knocked it together very quickly and am fairly certain that there's a bug in...

  • RE: Searching for a table

    bodsda (1/6/2012)


    Thanks for that, it worked. But why didn't my cursor work?

    Thanks,

    Bodsda

    Because your EXEC only exists in relation to itself, it doesn't affect anything outside of it.

    Try this, hopefully it'll...

  • RE: Searching for a table

    I prefer to avoid CURSORs and loops when they aren't necessary, including the hidden one in sp_MsForeachdb.

    So how about this?

    DECLARE @TABLE VARCHAR(200), @sql VARCHAR(MAX)

    --Add your table name here

    SET @TABLE =...

  • RE: Are the posted questions getting worse?

    Ninja's_RGR'us (1/5/2012)


    The drag trick doesn't work for me.

    IE 8 all updates.

    Sorry, should have said that it doesn't work with IE (well, can't get it to work with 8 or 9)....

  • RE: Are the posted questions getting worse?

    Brandie Tarvin (1/5/2012)


    Does anyone else have issues with the Edit Signature page on the control panel? It only ever shows 1 line of the .sig in the edit window and...

Viewing 15 posts - 1,081 through 1,095 (of 2,007 total)