Jump to content

SQL Bahubali's please help


4Vikram

Recommended Posts

Insert into bbc select col1, col2, rownum() over(order by col1) as id, 'Somehardcode' x from ABC; 

Nuvvu ey db no cheppaledu but above should work in most of the dbs.

Link to comment
Share on other sites

1 minute ago, mettastar said:

Insert into bbc select col1, col2, rownum() over(order by col1) as id, 'Somehardcode' x from ABC; 

Nuvvu ey db no cheppaledu but above should work in most of the dbs.


    DECLARE @TEMP table (ID int IDENTITY (1,1), [DEVICE_TAG_NUMBER] NVARCHAR(50), [SCADA_DESCRIPTION] NVARCHAR(MAX))


    INSERT INTO @TEMP 
    ( 
        [DEVICE_TAG_NUMBER]
        ,[SCADA_DESCRIPTION]
    )

    select TOP 1 [DEVICE_TAG_NUMBER]
            ,[SCADA_DESCRIPTION]
    from [dbo].[STG_GPL_122_TEST_DATE_Temp]


    DECLARE @ID BIGINT
    DECLARE @EQUIPMENT_NAME VARCHAR(200)
    DECLARE @SAP_FUNC_LOC_CD VARCHAR(100)
    DECLARE @RECORD_CREATED_BY VARCHAR(100)
    DECLARE @RECORD_CREATED_DATE DATETIME2 (7)
    DECLARE @DEVICE_TAG_NUMBER VARCHAR(50)
    DECLARE    @SCADA_DESCRIPTION VARCHAR(MAX)

    SET @EQUIPMENT_NAME = '122-UploadedEquipment'
    SET @SAP_FUNC_LOC_CD = '122-UploadedSAPFunc'
    SET @RECORD_CREATED_BY = 'minums1'
    SET @RECORD_CREATED_DATE = GETDATE()

    while exists (select * from @TEMP)
    begin

       select top 1 @ID = ID,
                    @DEVICE_TAG_NUMBER = DEVICE_TAG_NUMBER,
                    @SCADA_DESCRIPTION = SCADA_DESCRIPTION
       from @TEMP
       order by ID asc

       -- Do something with your TableID
       
       EXEC [dbo].[usp_APP_ADD_EQUIPMENT_AND_MAP_SITE_CAT]  

       PRINT @ID

       delete @TEMP
       where ID = @ID

    end

    --drop table @TEMP;

Link to comment
Share on other sites

Just now, mettastar said:

Ignore my reply motham chadavaledu

ignored and post mine.. now the twist in my query is i have to cal one sp for which i dont know the parameters and I am waiting for feedback from my manager,. as they have to go  through a particular category and i dont know which category it should so waiting..

Link to comment
Share on other sites

17 minutes ago, 4Vikram said:

ignored and post mine.. now the twist in my query is i have to cal one sp for which i dont know the parameters and I am waiting for feedback from my manager,. as they have to go  through a particular category and i dont know which category it should so waiting..

k

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...