How to find dayname from the function

Hi
I am looking for , to get dayname  from the following function. Please help to correct this function Also the folowing error is coming
Select statements included within a function cannot return data to a client.
/****** Object:  UserDefinedFunction [dbo].[ufEmployeeHrs]    Script Date: 13/08/2014 16:21:37 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER FUNCTION [dbo].[ufEmployeeHrs](@Recordid int,@DateWorked date)
RETURNS decimal(4,2) 
AS 
BEGIN
    DECLARE @ret decimal(4,2) ;
DECLARE @DateName Varchar;
Strig dayname = SELECT datename(dw,convert(datetime, @DateWorked, 111));
If dayname='Monday' then
ret = select monhr from workhrs
End if
If dayname='Tuesday' then
ret = select tuehrs from workhrs
End if
    RETURN @ret;
END;
polachan

@Visakh16:
You might need to change your query slightly to return a single value:
SELECT TOP 1 @ret = CASE DATENAME(dw,convert(datetime, @DateWorked, 111))
WHEN 'Monday' then monhr
WHEN 'Tuesday' then tuehrs
END
from workhrs
WHERE RecordID = @Recordid
ORDER BY unknown_column
It need's to be noted that this query will only work if the language setting of the query is English.
Otherwise it'll fail.
An alternative would be:
SELECT TOP 1 @ret = CASE DATEDIFF(dd,0,@DateWorked)%7
WHEN 0 then monhr -- Monday
WHEN 1 then tuehrs -- Tuesday
END
from workhrs
WHERE RecordID = @Recordid
ORDER BY unknown_column

Similar Messages

  • When I open iPhoto 9.2.1 it says that my library needs to be upgraded but when I upgrade the library I am trying to open (33 GB worth of pictures from 2006) the new application says it cannot read the files and how to find them on the system to reimport?!

    When I open iPhoto 9.2.1 it says that my library needs to be upgraded but when I upgrade the library I am trying to open (33 GB worth of pictures from 2006) the new application says it cannot read the files and how to find them on the system to reimport?! and then I'd like to erase the original files since the space requirement is huge!!!! Why is upgrading software iPhoto such a pain. I've gotta get a presentation done and all I get for my money is roadblock!!!

    hello, it sounds like the library is damaged.
    Download iPhoto Library Manager and use its rebuild function. This will create a new library based on data in the albumdata.xml file. Not everything will be brought over - no slideshows, books or calendars, for instance - but it should get all your albums and keywords back.
    Because this process creates an entirely new library and leaves your old one untouched, it is non-destructive, and if you're not happy with the results you can simply return to your old one. 

  • How Can I Remove the Finder Icon From the Dock?

    Hi! Can someone tell me how to remove the Finder icon from the dock? I don't even care if Finder quits. I just want it removed from the dock. I really don't care if I can't get to my files. Please help.

    Start by going to your core services, (/system/library/coreservices). You can do this by pressing Shift+Cmd+G and then paste (/system/library/coreservices), without parentheses.
    After doing this, find Dock.app, right click, show package contents. This doesn't contain the icons on your dock, just finder and trash.
    After that, move all finder services to the desktop, and then erase them from the core services folder. At this point it will prompt you to put in your password, do so.
    Next you'll want to open terminal and type 'killall dock' or, you could restart your computer.
    This should remove the finder icon from your dock, while still giving you access to it from your desktop.
    Hope this helps!
    -C

  • My old emails and documents are not showing up in email or finder both from the same date and I cannot find them anywhere. I do not believe I have any archive settings on. Any idea how I get them to show up?

    my old emails and documents are not showing up in email or finder both from the same date and I cannot find them anywhere. I do not believe I have any archive settings on. Any idea how I get them to show up?

    Hello gpbondi,
    The following article provdies step-by-step instructions for downloading your purchases both in iTunes and on your devices.
    Download past purchases
    http://support.apple.com/kb/HT2519
    Cheers,
    Allen

  • Vision Acquisition Software installed, BUT why is the IMAQdx missing from the function palette?

    I just installed to the labview 2011, and many other modules and softwares including this VASAugust2010. But the IMAQdx is missing from the function palette (vision and motion). However the NI-IMAQ 4.5, IN-IMAQ IO 2.4.0 and NI-IMAQdx 3.7 are all clearly listed as installed in the NI software (contorl panel -> program - NI). In MAX, my usb webcam is also listed as NI-IMAQdx Devices and works well under MAX. But my own program is broken because the LV can't find those functions. So why the IMAQdx funtion is missing and how to fix it?  
    Thanks,
    Lei

    hi tommy
    check this may helps you http://digital.ni.com/public.nsf/allkb/A451D3CCBB740716862578FC004DB392
    Sasi.
    Certified LabVIEW Associate Developer
    If you can DREAM it, You can DO it - Walt Disney

  • HT1386 The first time I synced my iphone with my mac, I didn't realize that all of my photos from iphoto would transfer over to the phone.   Now, I need to remove some, as they are taking up too much space.  I cannot figure out how to remove them from the

    The first time I synced my iphone 4 with my mac, I didn't realize that all of my photos from the iphoto library would transfer over to the phone (more than 3,000).   Now, I need to remove some, as they are taking up too much space.  I cannot figure out how to remove them from the phone.  I tried to uncheck boxes and sync again, but I get a message that there is no room on the iphone.  I've read as many articles as I can find, but still cannot manage this.  Thanks for any help.

    Open itunes, connect iphone, select what you want, sync

  • How to recover photos from the recycle bin ?

    how to recover phontos from the recycle bin or how to find them on icloud ??

    If you are using Photo Stream on your computer (Mac - logged into iCloud & Phtot Stream on / PC - installed iCloud Control Panel logged in and have Photo Stream turned on) then the photos you deleted should be safe and sound on your computer. Otherwise you may be out of luck.

  • How to stream music from the Internet on airport express

    How to stream music from the Internet on airport express

    HACKINT0SH wrote:
    Well... do you see the airplay button?
    I tought Airplay is limited to stream music from Itunes to airport express.http://support.apple.com/kb/HT4437?viewlocale=nl_NL
    I also want to upgrade my hifi setup with the airport. But with macbook of late 2009 (OSx Lion) I wonder it would be possible to stream music form internet.
    On this forum, I could not find any guarantee that it might work with OSx ML.
    What do you think?

  • Function modules from the function pool Z_MEREP_G (Message no. MEREP_00530)

    We installed a new system and imported the syncbo definitions to this new system.
    After the import and generation of all T01 SyncBOs we get an error. E.g. for MAM25_016:
    Function modules from the function pool Z_MEREP_GEN_T01_MAM25_016 contain syntax errors
    Message no. MEREP_00530
    After investigation the following syntax error is shown:
    Source code   LZ_MEREP_GEN_T01_MAM25_016U04                  Line     641
    The FORM "MAM25_016_CONV_NAME" does not exist, but there is a FORM with the similar name "MAM25_016_I_CONVERSION".
    "MAM25_016_I_CONVERSION".
    We are already using three systems D -> Q -> P. The export/import of files between these systems work okay. But not with the new system. All are on NW04 SPS 18. In the other systems the form is available.
    Does someone have an idea how to solve this?
    Thanks in advance,
    Benjamin de Rijke

    Hello Rahul / Karthick,
    Thanks for the tip, I already reimported these with no effect. Next to this I deleted the function modules for a Z-syncbo (our own developed one). But this didn't help as well.  The MAM-SyncBO function group can not be deleted because the system is not a developement system. We are not allowed to develop things in this environment.
    I have the feeling that it has something to do with the initial setup of this system. All the others were first on SPS15 were we developed the SyncBOs. At a certain time we updated the systems to SPS18 and developed further. No issues so far regarding the import / export of the files from D to Q and P.
    Now we initial installed a new system on SPS18 and on this one the generation failes with the mentioned syntax error.
    Kind regards,
    Benjamin

  • Using an own function in a select how can i set that the function run once?

    Hi
    Using an own function in a select how can i set that the function run once, not in every row?
    Please help me
    Thanks
    Viktor

    Something like this ?
    SQL> select * from dept;
        DEPTNO DNAME                          LOC
            10 ACCOUNTING                     NEW YORK
            20 RESEARCH                       DALLAS
            30 SALES                          CHICAGO
            40 OPERATIONS                     BOSTON
    SQL> create or replace function ret_name (deptnum in number) return varchar2
      2  is
      3     name    varchar2(50);
      4  begin
      5     select dname into name
      6     from dept
      7     where deptno=deptnum;
      8     return name;
      9  exception
    10     when no_data_found then
    11             return('Not existent deptno');
    12* end;
    SQL> /
    Function created.
    SQL> select deptno, decode(rownum,1,ret_name(deptno),null) dname from dept;
        DEPTNO DNAME
            10 ACCOUNTING
            20
            30
            40
    SQL>

  • Find out from the machine name, what user is logged in

    thank you. Is there a way to find out from the machine name, what user is logged in or who the machine belongs to?
    I can actually find out from the username what machine they have because there is a field called the wWWHomePage that gets populated with the computer name
    how do I do that? 
    Also I have a list of email addresses. How do I find the username from the list of email addresses ?
    thanks

    I have no good way to test this, so you'll probably have to adjust this on your end:
    Get-Content .\users.txt | ForEach {
    $emailAddr = $_
    $props = @{
    EmailAddress = $emailAddr
    Username = ''
    ComputerName = ''
    ComputerPath = ''
    try {
    $userDetails = Get-ADUser -Filter "EmailAddress -eq '$emailAddr'" -Properties wWWHomePage -ErrorAction Stop
    $pcDetails = Get-ADComputer -Identity $userDetails.wWWHomePage -Properties CanonicalName -ErrorAction Stop
    $props.Username = $userDetails.SamAccountName
    $props.ComputerName = $userDetails.wWWHomePage
    $props.ComputerPath = $pcDetails.CanonicalName
    } catch {
    $props.Username = 'ERROR'
    $props.ComputerName = 'ERROR'
    $props.ComputerPath = 'ERROR'
    New-Object PsObject -Property $props
    } | Select EmailAddress,Username,ComputerName,ComputerPath
    Don't retire TechNet! -
    (Don't give up yet - 12,950+ strong and growing)

  • How to claim Mileage from the iPhone APP

    Has anyone figured out how to Claim Mileage from the iPhone app?
    That does not show up as an option when you add expense.
    Regards,
    Venkat

    Britt's right.  :-)  For a complete list of what's supported on mobile devices, please refer to the Help Center document "Using SAP Cloud for Travel and Expense from a Mobile Device".  You can find this in your SAP Cloud for T&E system or at http://help.sap.com/travel-od > February 2014 > SAP Cloud for Travel and Expense Library > Mobile Devices.

  • What is ilife ?? is it comes with macbook pro 13in ?? how to find out in the system

    what is ilife ?? is it comes with macbook pro 13in ?? how to find out in the system?? I am using OSX 10.8.5

    These are the iLife applications:
    http://www.apple.com/ilife/
    They come with every new Mac.  If they are not in your applications folder, download them from the App store.
    Ciao.

  • HT3546 I can't figure out how to install bonjour from the CD that came with my airport express.  Can anyone help?

    I can't figure out how to install bonjour from the CD that came with my airport.  Can anyone help?

    If you are having difficulties installing Bonjour from the Installation CD, you can download the latest version of Bonjour from here.

  • How to find out about the SMTP Server

    Hi,
    I have been trying to configure groupware in the portal - in particular I want to enable the sending of emails through the portal. I already have a how-to-guide that that seems to explain the steps quite well. However, it mentions that I need to know the SMTP Server of the email. Can you tell me how to find out about the SMTP Server? Where do I need to look for the name of it?
    Thank you and regards,
    Katharina

    Hi Katharina,
    you need the SMTP server of your company. This means you can't look for it in the portal, but have to ask the responsible person in your company.
    Kind regards,
    dominik

Maybe you are looking for

  • Adding Text to a PDF I opened in Adobe Reader

    ...my question sounds simple but I can't figure out what to do. I have some architect drawings that are PDFs. I need to add some text to them and then resave them as PDFs and I can't make this happen. I opened then in Photoshop Elements but it won't

  • How can I "Copy" the description from iPhotos?

    I am trying to get descriptions from iPhoto files into Family Tree Maker Mac2.  It seems that FTM doesn't import that info with the .jpg file, but that is a separate issue.  When I try to Copy the Description from the Info for a photo, I get strange

  • Photoshop CS2 crashes when trying to print

    I need some help with Photoshop 9.02 on an Intel Mac running OSX 10.5. When I try to print from the application it crashes to the desktop. I have tried removing and reinstall the printer, updating the drivers, and even removing photoshop and reinstal

  • Cluster and Content services

    Hi,     In our environment, we have two nodes in a cluster with Content services runnin on both the cluster nodes.      One of the process, which is configured to have watched folder end point. This process reads the document from watched folder and

  • Roller Images using templates

    I am having trouble getting rollover images to work using templates. For example, on the following 2 page templates: http://www.hollandelectronics.com/Templates/template.dwt and http://www.hollandelectronics.com/Templates/oem_products.dwt I put in se