title: Giving table friendly name in SQL query using MS SQL server
body: <p>I am using ADO.NET to execute store procedure. The store procedure is having multiple select statement. When I access DataSet, the tables are named as Table1, Table2 and so on. I want to give user friend name to each of these table. I do not want to use Table variable or temp tables in my SQL query. DO I have any other alternatives?</p>
  
  <p>I am using following code to get the dataset</p>
  
  <pre><code>SqlCommand cmd = new SqlCommand();
  SqlDataAdapter da = new SqlDataAdapter();
  
  DataSet ds = new DataSet();
  try
  {
      con.ConnectionString = ConfigurationManager.ConnectionStrings["connString"].ConnectionString;
      con.Open();
      cmd = new SqlCommand("sp_GetData", con);
      cmd.Parameters.Add(new SqlParameter("@ParamOne", param));
      cmd.CommandType = CommandType.StoredProcedure;
      da.SelectCommand = cmd;
      da.Fill(ds);
  
  }
  </code></pre>
  
  <p>I dont want to do this either</p>
  
  <pre><code>da.TableMappings.Add("Table", "MyTable1");
  da.TableMappings.Add("Table1", "MyTable2");
  da.TableMappings.Add("Table2", "MyTable3");
  </code></pre>
  
  <p>or this</p>
  
  <pre><code>ds.Tables[0].TableName = "NametbA";
  ds.Tables[1].TableName = "NametbB";
  </code></pre>
  
  <p><strong>Preferably I want to specify the name in the SQL query. The reason I want to use this approach is because, I will pass this dataset as it to a function which will write the table name into a file.</strong></p>
  
  <p>Please provide your suggestions.</p>
  
  <p>Thank you</p>