is it possible to set parameters in the SELECT clause in a prepared statement in Java? Something like this:
PreparedStatement prepStat = conn.prepareStatement("SELECT DISTINCT ? 'Typ' FROM employee");
prepStat.setString(1, typ);
ResultSet rs = prepStat.executeQuery();
while (rs.next())
{
String strFilter = rs.getString("Typ");
System.out.println("strFilter: "+strFilter);
}
When I execute those lines, I only get the header of the column and not the values. When I execute the query without the question mark in SQL Server, it works fine.