zoukankan      html  css  js  c++  java
  • TSQL存储过程:获取属性名称的HTML标签

    根据传入属性列,获取属性名,并组成HTML

    ALTER PROCEDURE [dbo].[w_Category_GetNamesByCPVIDs]
    @CateIDList nvarchar(300)
    AS
    DECLARE
        
    @GardIndex int,
        
    @CacheStr nvarchar(300),
        
    @CacheID nvarchar(10),
        
    @CacheName nvarchar(50),
        
    @RtnStr nvarchar(4000),
        
    @CID int,
        
    @CacheNameCN nvarchar(50),
        
    @CACHE_CPID int
    BEGIN
        
    SET @RtnStr='';
        
    SET @GardIndex=0;
        
    SET @CacheStr=@CateIDList;
        
    --只有一个属性
        IF(CHARINDEX('|',@CacheStr)=LEN(@CacheStr))
        
    BEGIN
            
    SET @GardIndex=CHARINDEX('|',@CacheStr)
            
    SET @CacheID=SUBSTRING(@CacheStr,0,LEN(@CacheStr))
            
    SET @CacheName=(SELECT CPVName FROM w_CateProValue WHERE CPVID=CAST(@CacheID AS int))
            
    SET @CacheNameCN=(SELECT a.CPNameCN from w_CategoryProperty a,w_CateproValue b where b.CPVID=@CacheID and a.CPID=b.CPID)
            
    SET @CacheStr='|';
            
    SET @CACHE_CPID=(SELECT CPID FROM w_CateProValue WHERE CPVID=@CacheID);
            
    SET @RtnStr='<font style="font-weight:lighter; color:#000000;"> > </font><font style="font-weight:normal; color:#8c0000;">'+@CacheName+'</font>';
        
    END;
        
    ELSE
        
    BEGIN
            
    WHILE(@GardIndex!=LEN(@CacheStr))
            
    BEGIN
                
    SET @GardIndex=CHARINDEX('|',@CacheStr);
                
    SET @CacheID=SUBSTRING(@CacheStr,0,@GardIndex);
                
    SET @CacheName=(SELECT CPVName FROM w_CateProValue WHERE CPVID=CAST(@CacheID AS int))

            
    SET @CacheNameCN=(SELECT a.CPNameCN from w_CategoryProperty a,w_CateproValue b where b.CPVID=@CacheID and a.CPID=b.CPID)
                
    SET @CacheStr=SUBSTRING(@CacheStr,@GardIndex+1,LEN(@CacheStr)-@GardIndex)
                
    if(@CacheName is not null)
                
    BEGIN
                    
    SET @CACHE_CPID=(SELECT CPID FROM w_CateProValue WHERE CPVID=@CacheID);
                    
    SET @RtnStr=@RtnStr+'<font style="font-weight:lighter; color:#000000;"> > </font><a name='''+@CacheID+''' id='''+CAST(@CACHE_CPID AS nvarchar)+
                                
    ''' href=''javascript:Add('+@CacheID+',"'+@CacheName+'",'+CAST(@CACHE_CPID AS nvarchar)+',1)''><font onmouseover="this.style.color=''#8c0000''" onmouseout="this.style.color=''#9a9a9a''" style="font-weight:normal; color:#9a9a9a;">'+@CacheName+'</font></a>';
                
    END
            
    END
        
    END
            
    PRINT(@CacheName)
        
    IF(@GardIndex=LEN(@CacheStrAND @CacheStr!='|')
        
    BEGIN
            
    SET @CacheID=SUBSTRING(@CacheStr,0,@GardIndex);
            
    SET @CacheName=(SELECT CPVName FROM w_CateProValue WHERE CPVID=CAST(@CacheID AS int))

            
    SET @CacheNameCN=(SELECT a.CPNameCN from w_CategoryProperty a,w_CateproValue b where b.CPVID=@CacheID and a.CPID=b.CPID)
            
    SET @CACHE_CPID=(SELECT CPID FROM w_CateProValue WHERE CPVID=@CacheID);    
            
    SET @RtnStr=@RtnStr+'<font style="font-weight:lighter; color:#000000;"> > </font><font style="font-weight:normal; color:#8c0000;">'+@CacheName+'</font>';
        
    END

        
    SELECT @RtnStr AS CateList;
    END


  • 相关阅读:
    ajax返回数据类型 text json xml
    用ajax实现三级联动
    利用封装类查询
    oracle 在已有实力上创建用户 并导入数据
    php加密算法及扩展安装
    有用可以用的连接
    nginx负载均衡配置文件
    php获取excel表格中数据的小方法 然后就可以放到数据库了
    关于PHP中Cann't redeclare class的错误
    php时间函数应用
  • 原文地址:https://www.cnblogs.com/lixx/p/1293209.html
Copyright © 2011-2022 走看看