How to call a function returning a scaler (String) in a view.

  • pooja.sharma 54426 (1/16/2014)


    Hi,

    Please import the attached excel to get data.

    Regards

    Pooja Sharma

    We don't want to download your excel file and then have to spend another 5-10 minutes importing data. We want to be able to copy and paste the insert statements that you create for us. Make it easy for us to work on your problem and you will find lots and lots of people helping.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

  • INSERT INTO [SampleProperty].[dbo].[Equipment]

    ([EquipmentNo]

    ,[Description]

    ,[EqType]

    ,[EquipTypeID]

    ,[ParentID])

    VALUES

    ('E1'

    ,'TestE1'

    ,'Motor'

    ,1

    ,null)

    GO

    INSERT INTO [SampleProperty].[dbo].[Equipment]

    ([EquipmentNo]

    ,[Description]

    ,[EqType]

    ,[EquipTypeID]

    ,[ParentID])

    VALUES

    ('E2'

    ,'TestE2'

    ,'Motor'

    ,1

    ,null)

    GO

    INSERT INTO [SampleProperty].[dbo].[Equipment]

    ([EquipmentNo]

    ,[Description]

    ,[EqType]

    ,[EquipTypeID]

    ,[ParentID])

    VALUES

    ('E3'

    ,'testE3'

    ,'Heater'

    ,4

    ,null)

    GO

    INSERT INTO [SampleProperty].[dbo].[EquipmentTypes]

    ([EquipTypeID]

    ,[EquipmentType])

    VALUES

    (1

    ,'Motor1')

    GO

    INSERT INTO [SampleProperty].[dbo].[EquipmentTypes]

    ([EquipTypeID]

    ,[EquipmentType])

    VALUES

    (2

    ,'Busbar1')

    GO

    INSERT INTO [SampleProperty].[dbo].[EquipmentTypes]

    ([EquipTypeID]

    ,[EquipmentType])

    VALUES

    (3

    ,'Switchboard1')

    GO

    INSERT INTO [SampleProperty].[dbo].[EquipmentTypes]

    ([EquipTypeID]

    ,[EquipmentType])

    VALUES

    (4

    ,'Heater')

    GO

    INSERT INTO [SampleProperty].[dbo].[PropertyDef]

    ([PropName]

    ,[Caption]

    ,[ObjectTypeID])

    VALUES

    ('Color'

    ,'Color'

    ,3)

    GO

    INSERT INTO [SampleProperty].[dbo].[PropertyDef]

    ([PropName]

    ,[Caption]

    ,[ObjectTypeID])

    VALUES

    ('Height'

    ,'Height'

    ,3)

    GO

    INSERT INTO [SampleProperty].[dbo].[PropertyDef]

    ([PropName]

    ,[Caption]

    ,[ObjectTypeID])

    VALUES

    ('Frequency'

    ,'Frequency'

    ,3)

    GO

    INSERT INTO [SampleProperty].[dbo].[EPropertyData]

    ([ObjectId]

    ,[PropertyDefID]

    ,[PropValue])

    VALUES

    (1

    ,1

    ,'Red')

    GO

    INSERT INTO [SampleProperty].[dbo].[EPropertyData]

    ([ObjectId]

    ,[PropertyDefID]

    ,[PropValue])

    VALUES

    (2

    ,1

    ,'Green')

    Go

    INSERT INTO [SampleProperty].[dbo].[EPropertyData]

    ([ObjectId]

    ,[PropertyDefID]

    ,[PropValue])

    VALUES

    (3

    ,3

    ,'12')

  • Thanks for the inserts. We are now almost a week into this problem and we have ddl and sample data. I know Dwain asked this already but what do you want for output? Can you give some insight as to what your query needs to do here?

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

  • please refer to my previous posts for the scenario in which i want outpt.

    I have posted some functions which returns a sql query as string and i want to call this function in a stored procedure and execute the query returned in stored procedure.

    the output required is attached as image file.

    Regards

    Pooja

Viewing 4 posts - 16 through 18 (of 18 total)

You must be logged in to reply to this topic. Login to reply