The 1C:Enterprise developers forum

#1
People who like this: 0 Yes / 0 No
Active user
Rating: 4
Joined: Sep 1, 2014
Company: Smart ID Dynamics

Hello Timofey.

I need to call from 1C a stored procedure form SQL SERVER and get the result.

Any idea on how to do this?

Thanks.

 
#2
People who like this: 0 Yes / 0 No
Timofey Bugaevsky
Guest

Joined:
Company:

Hello, Marius Gidu.

You can use External data sources for this. There is an example in the Tabular Section, ValueTable, FormDataCollection Vs SpreadSheetDocument topic.
The difference is that in your case you need to add a stored procedure definition (see the attached screenshot).

To execute the stored procedure you can use the following script:

Code
ExternalDataSources.StoredProcedure.StoredProcedure(parameter1, parameter2, ...)

Download sp.png (37.32 KB)
 
#3
People who like this: 0 Yes / 0 No
Active user
Rating: 4
Joined: Sep 1, 2014
Company: Smart ID Dynamics

Thanks. But my return type is none of the type in the Type field.

How i can do this entirely from code.

 
#4
People who like this: 0 Yes / 0 No
Timofey Bugaevsky
Guest

Joined:
Company:

If you want to get a table as a result, it is better to create a view or a table with precalculated data, depending on the data load.

 
#5
People who like this: 0 Yes / 0 No
Active user
Rating: 4
Joined: Sep 1, 2014
Company: Smart ID Dynamics

Please can you give a complete example of this?

Thanks.

 
#6
People who like this: 0 Yes / 0 No
Timofey Bugaevsky
Guest

Joined:
Company:

Marius Gidu, the view is created on SQL level. For example, in MS SQL

Code
CREATE VIEW view_name AS 
SELECT table.id, table.value, ...
FROM some_table table

The table with precalculated data is an ordinary SQL table where you can update data that you can calculate when in the source table some changes are made.

The rest is done same as in the example above.

Hope, this helps.

 
Subscribe
Users browsing this topic (guests: 5, registered: 0, hidden: 0)