Firstly you'd need a connection string somewhere in your powershell script such as:
$connectionstring= "SERVER=servername; database=databasename; user id=username;password=password
Then you'd need to append the query to a string something like:
$myQuery =
@"
USE dbfile
SELECT *
FROM table.marker
WHERE table.marker = 0
ORDER BY table.sessionid
"@
Then you'd need to open an SQL connection with your query, create an SQL adapter with a dataset - something like:
$connection = New-Object System.Data.SqlClient.SqlConnection
$connection.ConnectionString = $connectionstring
$command = New-Object System.Data.SqlClient.SqlCommand
$command.CommandText = $myQuery
$command.Connection = $connection
$SqlAdapter = New-Object System.Data.SqlClient.SqlDataAdapter
$SqlAdapter.SelectCommand = $command
$myDataSet = New-Object System.Data.DataSet
$SqlAdapter.Fill($myDataSet)
Then you can call the dataset wherever you want using
$myDataset.Tables[0].rows (etc)...