/* * SP_LICENSE.SQL - displays ASE license options information * * Description * =========== * This file creates 'sp_license', a stored procedure displaying information * about license options in Sybase ASE 12.0+. * This file can be downloaded from www.sypron.nl/license.html . * * * Usage * ===== * sp_license [ license_option ] * * Without parameters, displays the status of all known license options * in the current ASE server. * With a license option as parameter (e.g. ASE_XML), displays only * that option, as well as the associated configuration parameter (if any). * * * Notes * ===== * * - None. * * * Requirements * ============ * This procedure requires ASE version 12.0 or later. * * * Installation * ============ * Execute this script using "isql", using a login having "sa_role". * The stored procedure will be created in the sybsystemprocs database. * * * Revision History * ================ * Version 1.0 31-Aug-2004 Version 1.0 * * * Copyright Note & Disclaimer : * ============================= * This software is provided "as is"; there is no warranty of any kind. * While this software is believed to work accurately, it may not work * correctly and/or reliably in a production environment. In no event shall * Rob Verschoor and/or Sypron B.V. be liable for any damages resulting * from the use of this software. * You are allowed to use this software free of charge for your own * professional, non-commercial purposes. * You are not allowed to sell or bundle this software or use it for any * other commercial purpose without prior written permission from * Rob Verschoor/Sypron B.V. * You may (re)distribute only unaltered copies of this software, which * must include this copyright note, as well as the copyright note in * the header of each stored procedure. * * Note: All trademarks are acknowledged. * * Please send any comments, bugs, suggestions etc. to the below email * address. * * (c) 2004 Copyright Rob Verschoor/Sypron B.V. * * Email: rob@sypron.nl * WWW : http://www.sypron.nl/ *---------------------------------------------------------------------------- */ set nocount on go set flushmessage on go use master go if charindex("sa_role", show_role()) = 0 or charindex("sso_role", show_role()) = 0 begin print "" print "" print "***************************************" print "***************************************" print " You need 'sa_role' and 'sso_role' " print " to run this script." print " Please retry with these roles enabled." print " Aborting..." print "***************************************" print "***************************************" print " " print " " print " " print "" set background on -- terminate this script now end go -- -- check we're at version 12.0 or later -- if isnull(object_id("master.dbo.sysqueryplans"),99) >= 99 begin print "" print "" print "****************************************" print "****************************************" print " This script requires ASE 12.0 or later." print " Aborting..." print "****************************************" print "****************************************" print " " print " " print "" set background on -- terminate this script now end go ------------------------------------------------------------------------------ use sybsystemprocs go print "Creating procedure 'sp_license'..." if object_id("sp_license") <> NULL begin drop proc sp_license end go create proc sp_license /* Copyright (c) 2004 Rob Verschoor/Sypron B.V. */ @p_option varchar(20)=NULL as begin declare @cfgopt int, @cfgval int, @cfgval_fmt varchar(20), @cfgname varchar(40) declare @v varchar(80), @c varchar(80) declare @x1 int, @x2 int, @x3 int set nocount on select @p_option = ltrim(rtrim(upper(@p_option))) select @x1 = charindex("/", substring(@@version,28,50)) select @x2 = charindex("/", substring(@@version,28+@x1,50)) select @x3 = charindex("/", substring(@@version,28+@x1+@x2,50)) select @v = "(" + substring(@@version,28,@x1+@x2+@x3) + ")" select @c = " Current ASE server: " + @@servername + " " + @v print @c create table #licensekeys (optname varchar(15), version varchar(12), description varchar(28), cfgopt int) insert #licensekeys values ('ASE_SERVER', "12.0+", "Enterprise Edition", 0) insert #licensekeys values ('ASE_SBE', "12.5.0.2+", "ASE Small Business Edition", 0) insert #licensekeys values ('ASE_DEV', "12.5.0.1+", "ASE Developer's Edition", 0) insert #licensekeys values ('ASE_HA', "12.0+", "High Availability", 378) insert #licensekeys values ('ASE_JAVA', "12.0+", "Java-in-ASE", 339) insert #licensekeys values ('ASE_ASM', "12.0+", "Advanced Security Mechanisms", 400) insert #licensekeys values ('ASE_DTM', "12.0+", "Distributed Transaction Mgt.", 381) insert #licensekeys values ('ASE_EJB', "12.5+", "Enterprise Java Beans", 392) insert #licensekeys values ('ASE_XFS', "12.5+", "External File Systems", 285) insert #licensekeys values ('ASE_EFTS', "12.5+", "Full text search", 287) insert #licensekeys values ('ASE_DIR', "pre-12.5.0.2", "LDAP", -1) insert #licensekeys values ('ASE_DIRS', "12.5.0.2+", "LDAP", 418) insert #licensekeys values ('ASE_XRAY', "12.5.0.3+", "DBXRay", -1) insert #licensekeys values ('ASE_XML', "12.5.1+", "Native XML in ASE", 419) insert #licensekeys values ('ASE_WEBSERVICES', "12.5.1+", "Webservices in ASE", 420) insert #licensekeys values ('ASE_MESSAGING', "12.5.2+", "Real-Time Database Services", 429) -- apply filter print "" select l.optname "License Option", l.description "Description", case license_enabled(l.optname) when 1 then "Enabled" when 0 then "Disabled" else version + " only" end "Option Status", --right(space(14)+ case c.value when 0 then 'Disabled (0)' when 1 then 'Enabled (1)' else '' end --,14) "Cfg.Value(run)" from master..syscurconfigs c, #licensekeys l where optname = isnull(@p_option, optname) and c.config =* l.cfgopt if @@rowcount = 0 begin print " " print " No such license option: %1!", @p_option return(0) end if @p_option <> NULL begin select @cfgopt = cfgopt from #licensekeys where optname = @p_option if @cfgopt = 0 begin print "" if @p_option = 'ASE_SERVER' begin print " In 12.5+, the ASE_SERVER option is needed to run the ASE Enterprise Edition" print " (no ASE-implied limits on the number of users or engines)." print " In 12.0, the ASE_SERVER option is needed to enable other license options." end if license_enabled(@p_option) = NULL return(0) if @p_option = 'ASE_DEV' begin print " The free ASE Developer's edition automatically enables most other license " print " options, but limits the number of user connections to 25 (in 12.5.1, to 5)" print " and the number of engines to 1." end if @p_option = 'ASE_SBE' begin print " The ASE Small Business Edition limits the number of user connections to 256" print " and the number of engines to 4." end print "" print " The '%1!' option takes effect automatically during ASE startup.", @p_option return(0) end if @cfgopt = -1 begin if @p_option = 'ASE_DEV' begin print " The ASE " end return(0) end select @cfgname = name from master..sysconfigures where config = @cfgopt select @cfgval = value from master..syscurconfigs where config = @cfgopt select @cfgval_fmt = case @cfgval when 0 then '0 (=Disabled)' when 1 then '1 (=Enabled)' else '' end if license_enabled(@p_option) = NULL return(0) -- note: we cannot call sp_configure here to display parameter info, since sp_configure -- does not allow being called from another procedure print "" print " To enable the '%1!' option, the ASE configuration parameter", @p_option print " '%1!' must also be enabled. The current run value is %2!", @cfgname, @cfgval_fmt end return(0) end go grant exec on sp_license to public go -- -- end of file --