Forum Replies Created

Viewing 15 posts - 631 through 645 (of 897 total)

  • RE: Days in a month

    subbusa2050 (11/24/2010)


    Hi WayneS ,

    Please read my complete post and reply back. I am asking how Chris Morris got 1319 in that datediff function, other than that u...

  • RE: retrieve Column Names from Table and Used in QUERY

    You will have to use Dynamic SQL for the same

    EXECUTE sp_executeSQL @result

    Check for sp_executeSQL in Books Online or Google.

  • RE: SQL SELECT statement to show data in several columns

    Not sure if i understood your requirement correctly, but i hope this is what you want.

    DECLARE@tbl_Items TABLE

    (

    Item_NoINT,

    LanguageVARCHAR(10),

    DescriptionVARCHAR(100)

    )

    INSERT@tbl_Items

    SELECT1, 'EN', 'descr. english1' UNION ALL

    SELECT1, 'IT', 'descr. italian1' UNION ALL

    SELECT2, 'EN', 'descr. english2'...

  • RE: IF EXISTS Problem

    You cannot execute Dynamic queries in this manner

    You will have to do some changes as shown below

    DECLARE @strSQL NVARCHAR(100)

    DECLARE@iCount INT

    SET @strSQL = 'SELECT @iCount = COUNT(*) FROM dbo.TableName'

    EXECUTE sp_executeSQL @strSQL,...

  • RE: Understanding JOINS

    1) There is nothing called the LEFT INNER JOIN. It is always a LEFT OUTER JOIN where the word OUTER is optional. So you can also write the same as...

  • RE: Replace two values

    You will have to use a nested REPLACE for this like the below example

    DECLARE@strVariable VARCHAR(100)

    SET@strVariable = 'a1b2c3'

    SELECTREPLACE( REPLACE( REPLACE( @strVariable, 'a', '' ), 'b', '' ), 'c', '' )

  • RE: Expression in WHERE and SELECT

    I think you can re-write the query as below or is this a really over simplified example? Anyways, as Mr. Magoo said, you can check the same in the Execution...

  • RE: create table abcde(id int identity, name varchar(20)default 'abcd')

    You can use

    INSERT INTO abcde VALUES ( default )

  • RE: Help in SQL

    You can use the EXISTS clause for the same..

    SELECT*

    FROMMain M

    WHEREEXISTS

    (

    SELECT*

    FROMtbl_Filer F

    WHEREM.CODE = F.CODE AND M.CENTER = F.CENTER

    )

  • RE: Question on Merging two cases

    Glad i could help you out 🙂

  • RE: Question on Merging two cases

    It would be helpful if you post the complete SELECT query at least

    But i think this is what you want.

    DECLARE @status Varchar (10)

    SELECT @status='ALL'

    --following is the...

  • RE: Without while loop

    Not sure but i hope this is what you want..

    SELECTQT.QuestionId, QT.QuestionLabel

    FROM@QuestionTable QT

    WHEREEXISTS

    (

    SELECT*

    FROM@DetailTable DT

    WHEREQT.FilterId1 = DT.FilterId1

    ANDQT.FilterId2 = DT.FilterId2

    ANDQT.FilterId3 = DT.FilterId3

    )

  • RE: How to replace first occurrance of pipe delimeter

    You can use the SUBSTRING and LEN function as below..

    DECLARE@strVariable VARCHAR(100)

    SELECT@strVariable = '| hello | world | I love sql server'

    SELECTCASE

    WHEN SUBSTRING( @strVariable, 1, 1 ) = '|'

    THEN SUBSTRING( @strVariable,...

  • RE: SQL Server Query Hints

    Detailed explanation on Query Hints cannot be given as answers to questions on forums. Search for the same in Google or Books Online.

    Also take a look the book Dissecting SQL...

  • RE: Need to Duplicate Data

    Providing the DDL of the table involved, some sample data and the expected result would help a lot in solving your problem

    Also if you tried something yourself provide the proper...

Viewing 15 posts - 631 through 645 (of 897 total)