Forum Replies Created

Viewing 15 posts - 226 through 240 (of 430 total)

  • RE: Monthly Report

    The script is only for inserting  the data into @MyTable.

    SELECT * FROM @MyTable

    Will give you the table with data to test the queries. I wanted to give Random...

  • RE: Is it possible to create a temp table with dynamic columns?

     ##MyTable in a stored procedure. What will happen if more than one call at a time to the stored procedure?

    Another question how did you make thread inside a thread. Or...

  • RE: Can I use UDF for get the sequence number ??

    /* Use SCOPE_IDENTITY() to get the identity value inserted in scope */

    SET NOCOUNT ON

    GO

    CREATE TABLE TEST

    (

    MyID INT IDENTITY,

    MyOtherCol VARCHAR(20),

    MyDesc  VARCHAR(20)

    )

    GO

    CREATE PROCEDURE Test_Insert

    (

    @pMyDesc VARCHAR(20)

    )

    AS

    SET NOCOUNT ON

    INSERT INTO TEST (MyOtherCol, MyDesc) VALUES ('', @pMyDesc)

    UPDATE TEST

    SET

     MyOtherCol =...

  • RE: INSERT column value with imbedded apostraphe

    SET NOCOUNT ON

    DECLARE @Countries TABLE

    (

    CountryCode INT,

    CountryName VARCHAR(100)

    )

    INSERT INTO @Countries VALUES (1, 'Country Name 1')

    INSERT INTO @Countries VALUES (5, 'Cote D''Ivoire')

    SELECT * FROM @Countries

  • RE: Global script for databases and owners

    select db.[name] [database], l.[name] [owner]

    from

     master.dbo.sysdatabases db

    join

     master.dbo.syslogins l

    on

     db.sid = l.sid

  • RE: Storing Credentials securely

    If you are using ASP.NET use

    System.Security.Cryptography class library to encrypt and decrypt the credentialls.

  • RE: Rows into CSV resultset

    SELECT @Result = COALESCE(@Result + ', ', '') + CONVERT(VARCHAR, ColA)

    FROM

      (SELECT TOP 100 PERCENT * FROM @MyTable ORDER BY 1) A

  • RE: Rows into CSV resultset

    SET NOCOUNT ON

    DECLARE @MyTable TABLE

    (

    ColA     INT,

    ColB     VARCHAR(10)

    )

    INSERT INTO @MyTable VALUES (1,'AAAA')

    INSERT INTO @MyTable VALUES (2,'BBBB')

    INSERT INTO @MyTable VALUES (3,'CCCC')

    INSERT INTO @MyTable VALUES (4,'DDDD')

    INSERT INTO @MyTable VALUES (5,'EEEE')

    /* RESULT */

    DECLARE @Result...

  • RE: Grouping using compute

    I thougt I used rollup in my reply.

    try

    SELECT * INTO #Result

    'Your Query with Rollup'

    Edit/delete and update #Result

    SELECT * FROM #Result

     

    Or you can merge the multiple datatables into...

  • RE: Grouping using compute

    Workaround

    SELECT * INTO #Result

    'Your Query with COMPUTE BY'

    SELECT * FROM #Result

    SELECT * INTO #Result

    'Your Query with Rollup'

    Edit/delete and update #Result

    SELECT * FROM #Result

  • RE: Trouble with datatypes and the CASE statement

    My Mistake. Check This.

    DECLARE @MyTable TABLE

    (

    MyVal Varchar(100),

    Deleted BIT

    )

    INSERT INTO @MyTable VALUES ('MyVal1', 0)

    INSERT INTO @MyTable VALUES ('MyVal2', 1)

    INSERT INTO @MyTable VALUES ('MyVal3', 0)

    INSERT INTO @MyTable VALUES ('MyVal4', 1)

    INSERT INTO @MyTable...

  • RE: SQL join

    HTH

  • RE: SQL join

    SET NOCOUNT ON

     

    DECLARE @Book TABLE

    (

    bookID INT,

    ISBN VARCHAR(100)

    )

    DECLARE @Contributor TABLE

    (

    contributorid INT,

    FirstName VARCHAR(100),

    LastName VARCHAR(100)

    )

    DECLARE @bookContributor TABLE

    (

    BookContributorID INT,

    bookID INT,

    contributorid INT

    )

    INSERT INTO @Book VALUES (1, '12345')

     

    INSERT INTO @Contributor VALUES (1, 'Tom', 'Clancy')

    INSERT INTO @Contributor...

  • RE: Trouble with datatypes and the CASE statement

    SELECT *

    FROM myTable

    WHERE @filter = CASE WHEN Deleted = 0 THEN 'Active'

            WHEN Deleted = 1 THEN 'Inactive'

            WHEN Deleted IN (0, 1) THEN 'All'

Viewing 15 posts - 226 through 240 (of 430 total)