Navigation

Search

Categories

On this page

jQuery User Interface
Examples of using output parameters with SQL Server
Creating a SQL User Defined Function
Open Source Templates

Archive

Blogroll

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

RSS 2.0 | Atom 1.0 | CDF

Send mail to the author(s) E-mail

Total Posts: 240
This Year: 46
This Month: 3
This Week: 0
Comments: 0

Sign In
Pick a theme:

# Wednesday, February 18, 2009
Wednesday, February 18, 2009 8:04:55 PM (GMT Standard Time, UTC+00:00) ( jQuery )


I was working on a project at work involving the use of jQuery table sorter and came across another jQuery site which is as equally awesome – jQuery User Interface. The site describes itself as “jQuery UI provides abstractions for low-level interaction and animation, advanced effects and high-level, themeable widgets, built on top of the jQuery JavaScript Library, that you can use to build highly interactive web applications.”  Any type of UI interaction you can think of is probably possible using this library.

Comments [0] | | # 
# Friday, February 13, 2009
Friday, February 13, 2009 9:24:34 PM (GMT Standard Time, UTC+00:00) ( SQL )


CREATE PROCEDURE [dbo].[GetLastAccountLogin] 
    -- OUTPUT parameter to hold the count.
    @AccountNo Varchar(50), 
    @ReturnVal smalldatetime = ' ' OUTPUT 
AS 
    -- This will return the last date returned by the SELECT query. 
    Set @ReturnVal = SELECT MAX(Login) FROM TUserLogs WHERE AccountNo=@AccountNo



CREATE PROCEDURE [dbo].[GetTotalUserCompanyProfileViews] 
    -- OUTPUT parameter to hold the count.
    @UserID int,
    @ReturnVal int OUTPUT 
AS 
    -- This will return the totals returned by the SELECT query.     
    SET @ReturnVal = SELECT COUNT(ID) FROM TTrackSearchResults WHERE UserID=@UserID
Comments [0] | | # 
# Thursday, February 12, 2009
Thursday, February 12, 2009 4:48:35 PM (GMT Standard Time, UTC+00:00) ( SQL )

In the past, I would usually just create a client side or front-end function to change the way data is displayed to the user but this example shows how to do this in SQL Server using a User Defined Function or UDF.

CREATE FUNCTION [dbo].[GradeConversion](@Grade varchar(50))
RETURNS varchar(50)
AS
BEGIN
    DECLARE @MyOutput varchar(50)
    If @Grade='A'
        SET @MyOutput = 'Low Concern'
    Else if @Grade='B'
        SET @MyOutput =  'Low Concern'
    Else if @Grade='C'
        SET @MyOutput =  'Moderate Concern'
    Else if @Grade='D'
        SET @MyOutput =  'High Concern'
    Else if @Grade='F'
        SET @MyOutput =  'Very High Concern'
    Else
        SET @MyOutput =  'Not Rated'
RETURN @MyOutput
END

To call this function you would simply do this dbo.GradeConversion(dbo.companyRatings.ScoreCEOComp) AS ScoreCEOComp

Comments [0] | | # 
# Monday, February 09, 2009
Monday, February 09, 2009 2:28:21 PM (GMT Standard Time, UTC+00:00) ( CSS | HTML )

 

A couple of sources for great, free Web templates for the design-challenged.

http://www.oswd.org/ 

http://www.opendesigns.org/

Comments [0] | | #