Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

easy sql

Posted on 2011-09-16
4
184 Views
Last Modified: 2012-05-12
select convert(varchar, o.dateSubmitted, 111) as dateSubmitted from tblCustomer

I have that query that I want to say if dateSubmitted is not null that time I want to "paid" on my datagrid...how can I make that happen?
0
Comment
Question by:1jaws
  • 2
  • 2
4 Comments
 
LVL 51

Accepted Solution

by:
HainKurt earned 500 total points
ID: 36552268
try:

case when o.dateSubmitted is null then 'Paid' else convert(varchar, o.dateSubmitted, 111) end as dateSubmitted
0
 

Author Comment

by:1jaws
ID: 36552274
we are adding this to select statement how?
0
 

Author Comment

by:1jaws
ID: 36552293
ignore what I said... sorry.. thanks for the help.
0
 
LVL 51

Expert Comment

by:HainKurt
ID: 36552296
first of all your query syntax is wrong. there is no alias as o

select convert(varchar, o.dateSubmitted, 111) as dateSubmitted from tblCustomer as o

-->

select
case when o.dateSubmitted is null then 'Paid' else convert(varchar, o.dateSubmitted, 111) end as dateSubmitted
from tblCustomer as o
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Hi all, It is important and often overlooked to understand “Database properties”. Often we see questions about "log files" or "where is the database" and one of the easiest ways to get general information about your database is to use “Database p…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question