Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
CASE like T-SQL Statement?
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00810234
Message ID:
00810457
Vues:
8
hi stephen,

I have done a case statement in SQL Server is this is what you want ?


select ="SELECT Job_Header.id, Job_Header.Job_Description,"+
"Client.Trading_Name,Job_Header.Due_Date,job_header.due_time, RTRIM(User_table.First_Name) "+
"+ ' ' + RTRIM(User_table.Last_Name) AS username, "+
" NEXTACTION.DESCRIPTION as NextAction,"+
" Job_Status_Name = "+
" case "+
" when job_header.authorised = 1 then '"+lccompleted+"'"+
" when job_managers.job_read = 0 then '"+lcunreadstring+"'"+
" when job_header.due_date < '"+lctodaystring+"' then '"+lcoverdue+"'"+
" when job_header.due_date = '"+lctodaystring+"' then '"+lcduetoday+"'"+
" END,"+
" Job_Status_Code = "+
" case "+
" when job_header.authorised = 1 then 4"+
" when job_managers.job_read = 1 then 3"+
" when job_header.due_date < '"+lctodaystring+"' then 2"+
" when job_header.due_date = '"+lctodaystring+"' then 1"+
" END,"+
" job_managers.job_read,"+
" 'A' as sort_order,nextaction.sort_order as nasort,substring(cast(due_date as char(50)),1,11)+"+
"substring(cast(due_time as char(50)),12,15) as Due_Date_time_string"+
" FROM Job_Header INNER JOIN Client ON Job_Header.Client_ID = Client.id "+
" inner join nextaction on job_header.next_Action_id = nextaction.ID"+
" inner join job_managers on job_header.ID = job_managers.job_id "+
" inner join user_table on job_managers.user_id = user_table.ID "+
" and job_managers.user_ID = "+user_id+
lcwherestring+
" ORDER BY due_date desc,due_time";

>I need to build a string for a WebForm display. I have a need for a CASE statement to take the display from a drop down and concatinate it ie:
>LEFT = L.H. RIGHT = R.H.
>
>I am combining 7 different dropdowns for this user request, and this is the sticking point I have so far.
>
>Any ideas?
>
>TIA
>
>__Stephen
Fred Besterwitch, MCP

The harder you work. The luckier you get.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform