.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

how to use if statment in t-sql

Posted By:      Posted Date: September 07, 2010    Points: 0   Category :Sql Server
Hello Example i have following table named "sales": id         item_no             price           type     1            a                       10             retail     2            a                       15             retail_n     1            b                       25             retail   I want to get prices for all items, but if type is "retail_n then" i want to get this price. if not i want to get "retal" price. for my example result must be: 2    

View Complete Post

More Related Resource Links

Problems creating a BDC file that use a unique select statment


I'm trying to build an BDC file that will pull information back from two tables in an Oracle database, I can import it without any errors, but then it tells me I do not have a filter when I try and select an item.  When I add a filter I get an error when I import the file.  The error I get is the following.
"Application definition import failed. The following error occurred: The IdentifierName Attribute of the TypeDescriptor named 'TestDate' of the Parameter named ':TestDate' of the Method named 'Get_TestTwelve_List' of the Entity named 'TestTwelve' does not match any of the defined Identifiers for the Entity. Error was encountered at or just before Line: '133' and Position: '16'."

Here is the section of

      <Property Name="RdbCommandText" Type="System.String"><![CDATA[

Needing two different years pulled from same select statment

Making a sales,cost table equal for one year select all sales from dbo where year = 2008 select all costs from dbo where year = 2008 but now i want to put beside this table select all sales from dbo where year = 2009 select all costs from dbo where year = 2009    How can i achieve this in one table?   Thanks for all the help

Update Statment question

I came across a problem to update a varchar(MAX) field. I use a varchar(MAX) field to save transaction data. It is required to update that field once a while by removing sensetive infromation from that field. I use update statment to do that and everything looks fine. But, if I back up the database and open it using notepad I can see those sensetive strings. It looks to me that update statement allocates another space to save the new data and does not zero fillout the space used by old data. It is kind of like deleting files from OS. What can I do in this case?   Thanks, David    

Merge statment error message




I'm trying the below query , but cannot work out how to overcome the error message. Any help please . Thanks Rob




Executing sql statment stored in temp table (without variables)


How could I execute a sql statement stored in a temp table? something like




'select * from sysobjects' as test into #tmp




Update statment syntax


update dbo.Spectrum_ScoreCard_NEW
set branch = dbo.tblUser.fldUserBranch
dbo.Spectrum_ScoreCard_NEW.Name = dbo.tblUser.fldUserFName + ' ' + dbo.tblUser.fldUserLName


I want to update all the branches in spectrum scorecard with the branches in userbranch where they names are the same.

what is wrong with this syntax?

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend