title: What is {0},{1},{2},{3} in the SQL query
body: <p>I want to know what {0} or {1} mean in the query given below</p>
  
  <pre><code>public static int EnsureObjectHasAliases(string type, int id, int programId, string[] aliasList)
  {
      var sb = new StringBuilder();
      if(aliasList!=null)
      for (int i = 0; i &lt; aliasList.Length; i++)
      {
          string alias = aliasList[i];
          if (NormalizeString(ref alias))
          {
          if (sb.Length &gt; 0)
          sb.Append(",");
          sb.Append(FormatStringForSql(alias));
          }
      }
      if (sb.Length &gt; 0)
      {
          string aliases = sb.ToString();
          var c = (int)GetValue("SELECT count(*) FROM {0}Alias WHERE ProgramId = {1} AND {0}Id = {2} and Alias in ({3})", type, programId, id, aliases);
      if (c &gt; 0)
         return id;
  
      if (aliasList != null)
      if (aliasList.Any(alias =&gt; AddObjectAlias(type, programId, alias, id) &lt; 0))
          return -1;
      }
          return id;
      }
  </code></pre>
  
  <p>I have no idea what this query means:</p>
  
  <pre><code>SELECT count(*) FROM {0}Alias WHERE ProgramId = {1} AND {0}Id = {2} and Alias in ({3})
  </code></pre>
  
  <p>I want to know what <code>{0} or {1} or {2} and {3}</code> and <code>ALIAS</code> is in the query. I know that it is representing some table but how?</p>
  
  <p>Is it something related to <code>String.Format()</code>?</p>
  
  <p><strong>EDIT:-</strong></p>
  
  <p>My GetValue() function is like this:</p>
  
  <pre><code>public static object GetValue(string sql, params object[] args)
  {
      return GetValue(GlobalFactories.GetLogger().GetDefaultTransaction(), sql, args);
  }
  public static object GetValue(SqlConnection db, string sql, params object[] args)
          {
              return GetValue(GlobalFactories.GetLogger().GetDefaultTransaction(), db, sql, args);
          }
  
  public static object GetValue(LogTransactionBase logTransaction,SqlConnection db,  string sql, params object[] args)
  {
      if (string.IsNullOrEmpty(sql))
      return null;
      if (args != null &amp;&amp; args.Length &gt; 0)
          sql = string.Format(sql, args);
          LastQuery = sql;
          var needToDispose = false;
          if(db==null)
          {
          db = GetDB();
          needToDispose = true;
          }
      try
      {
      using (var cmd = db.CreateCommand())
      {
       cmd.CommandText = sql;
       cmd.CommandTimeout = TIME_OUT;
       var v = cmd.ExecuteScalar();
       if (v == DBNull.Value) v = null;
       return v;
      }
      }catch(Exception ex)
      {
       logException(logTransaction,sql,ex);
       throw;
      }
      finally
      {
      if (needToDispose)
      db.Dispose();
      }
      }
  </code></pre>