Select querry in SQL Server using Execute Command

Hi,
Could someone explain me how can I select query in SQL Server. I entered the connection string and tried different select methods like :

1 → SELECT col1,col2 FROM [dbo].[table] WHERE col3 > 50

2 ->SELECT [col1]
,[col2]
FROM [dbo].[table]
WHERE col 2>50
GO

Nothing works. The query fails, please help !
Thank you !

Hi,

Which activity are you using? The ‘Execute query’ activity is used to execute select statements in the database and retrieve the results in a datatable.
If you donot see the ‘Execute query’ activity in your activities pane, please go to packages and install the Databases package.

Regards,
Amrita

1 Like

I used Execute query and yes I tried to retrieve the results in dataTable, yet it does not work, I get nullReferenceException because the query does not execute and the data table is empty

Can someone show an example of a working select update or delete query? That would be wonderful,

Thanks!

I am trying to extract data from Access using ODBC connection. Select query syntax in EXECUTE command does not work. Please share sample workable syntax. it will be helpful.

Thank you!!

Hi,
Check if the connection is still open, or somewhere on the line you closed the connection, for me that was the issue .
Hope this may help you ! ( also if the connection is not open then the query won’t work)

Regards,
Serban

1 Like