Donate

Ambigous Column Name In SQL Server TSQL Query

If you encounter this error in your TSQL query embedded in C#, you might want to check the table it is being joined. It might be that some field in the other table has the same fieldname.
Example
Orders - status varchar(90)
OrdersSubForm - status varchar(30)
Just make sure, you create a prefix of the table name plus the dot and append it in your field. Just like the example below, for the status field.
  Select   
   Orders.status,  
   OrderNum  
  from Orders  
  right outer join OrderSubForm  
  on OrderSubForm.ID = Orders.ID  
  where (your condition here)  

Comments

Donate

Popular Posts From This Blog

WPF CRUD Application Using DataGrid, MVVM Pattern, Entity Framework, And C#.NET

How To Insert Or Add Emojis In Microsoft Teams Status Message

Bootstrap Modal In ASP.NET MVC With CRUD Operations