Forum Replies Created

Viewing 15 posts - 436 through 450 (of 454 total)

  • RE: Help with Joins

    Use the same table with Alias for each field like employees mgr on mgr.id=a.mgr_id , employees emp1 on emp1.id=a.emp1_id so on..

  • RE: select statement

     

    I tried this but got an error:-

    Error: Incorrect syntax near the keyword 'CASE'. (State:37000, Native Code: 9C)

    Any ideas why?

    The syntax should be pretty fine unless you forgot to...

  • RE: select statement

    Well what is the format in which the dated field is saved in present context.

  • RE: datetime conversion

    Yeah should absolutely solve it without any issues whatsoever.

     

  • RE: store stored proc results into table

    Well can we directly execute a Stored Procedure inside a Cursor and Loop over the results returned by the executed Stored Procedure.

    I don't know if this question is related in...

  • RE: INSERTING IN TEMP TABLE THRO DYNAMIC SQL

    I believe this should help:

     

    CREATE PROCEDURE USP_RULE

    AS

    CREATE TABLE #TABLE1

    (

        SlNo int identity(1,1), EqNum varchar(25),Pointnum varchar(25)

    )

    declare  @EqNum varchar(25),@Pointnum varchar(25)

    DECLARE @STRDBNAME VARCHAR(50)

    SET @STRDBNAME = 'DB1'

    EXEC('insert into #TABLE1 select EQNUM,POINTNUM from

  • RE: datetime conversion

    How about this, we can get rid of the substring as well.

    select ''''+convert(varchar(10),convert(datetime,'1 Feb 1990'),120)+''''

    Or say for current day

     

    select ''''+convert(varchar(10),convert(datetime,GETDATE()),120)+''''

     

     

  • RE: Dynamic Select

    Yeah seems to be a great article.

  • RE: Dynamic Select

    I hope this helps you

     

    CREATE PROCEDURE GetFacilities

     @userID NVARCHAR(100),

     @language NVARCHAR(100)

    AS

    DECLARE @sql_str VARCHAR(1000)

    SET @sql_str = 'SELECT Name,

    (SELECT ' + @language + ' FROM lkpfacilitytype WHERE ID = Type) AS Type,

     Address1,

     Address2,

     City,

     State,

     ZIP,

     Country,

     Phone,

     Fax,

     WebSite

    FROM tblFacilities

    WHERE...

  • RE: Oracle Migration to SQL Server

    Using is as good as passing the input parameters to SQL Query used in the cursor  :

    In Oracle in the example that you sited basically SQLVAL should have been a Dynamic SQL framed on some...

  • RE: Query Help: Replace between two tables for each row

    When the two tables are residing on two different databases is it not a must to prefix the database name to the table name like

    UPDATE database1.dbo.TableA Set ValueToBeReplaced =...

  • RE: How do I get the creation date of a Table.

    Well is there anyway that we can get the last modified date too like if we are adding some constraints from Enterprise Manager then basically it is going to dump...

  • RE: Issue with Dynamic SP

    I am wondering if the SP works at all with the syntax that it is written with currently , I believe the variables should not be included inside the...

  • RE: Maximum length of a Varchar Variable

    Well I found the problem with my code, basically I am calling the execute with a wrong syntax as

    exec @query1

    and then it is displaying an error

    Server: Msg 203, Level...

  • RE: Maximum length of a Varchar Variable

    Actually I never had a problem executing this query but my very issue was that when I keep the total query in a single variable say @query1 and execute @query1...

Viewing 15 posts - 436 through 450 (of 454 total)