Function For Return Table

CREATE FUNCTION dbo.GetResultSetFromString
 ( @InputString NVARCHAR(4000))

RETURNS @retRows TABLE (
 IndexString NVARCHAR(50) COLLATE DATABASE_DEFAULT,
 Priority TINYINT
 )

 AS 

BEGIN

DECLARE @index INT
DECLARE @Word NVARCHAR(4000)
DECLARE @CurrentWord VARCHAR(255)
DECLARE @Separator NVARCHAR(5)
DECLARE @LoopIndex TINYINT

SET @Separator = ' '
SET @index = 1
SET @Word = @InputString
SET @LoopIndex = 1
WHILE LTrim(RTrim(@WOrd)) != ''

 BEGIN
  SET @index = CHARINDEX ( @Separator , @Word , 1 )
 
  IF @index = 0
  BEGIN
   
   SET @index = Len(@Word) + 1
 
  END
 
  SET @CurrentWord = LEFT(@Word,@index - 1)
 
  SET @Word = SubString(@Word,@index+1,Len(@Word))
  
  IF LTrim(RTrim(@CurrentWord)) != ''
  BEGIN
   INSERT INTO @retRows (
    IndexString,
    Priority
   ) VALUES (
    @CurrentWord,
    @LoopIndex
   )
  END
 SET @LoopIndex = @LoopIndex + 1

 END
 
 RETURN
 
END

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

 

 

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO


CREATE FUNCTION  dbo.boaUpLow (@String VARCHAR(2000)) RETURNS VARCHAR(2000)
AS
 
BEGIN
 DECLARE @i INTEGER
 DECLARE @j INTEGER
 DECLARE @Result VARCHAR(2000)
 DECLARE @Upper AS INTEGER
 DECLARE @Find AS VARCHAR(2000)

 SET @j = 1
 SET @i= 1
 SET @Result =''
 SET @Find = ' -&()./_' /* Add to this string any character you want to eliminate */
 SET @Upper = 1

 WHILE(@i<=len(@String))

  BEGIN
   SET @j=1
   IF (@Upper = 1 )
    SET @Result = @Result + upper(Substring(@String,@i,1))
   ELSE
    SET @Result = @Result + Lower(Substring(@String,@i,1))
   /* End */

   SET @Upper = 0

   WHILE(@j<=len(@find))
    BEGIN
     IF  substring(@String,@i,1) = substring(@Find,@j,1)
       SET @Upper = 1 
     SET @j=@j+1
    END
   
   SET @i=@i+1
  
  END
 
 RETURN (@Result)
END

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE FUNCTION dbo.EscapeSingleQuotes (
 @String NVARCHAR(4000)
)
RETURNS NVARCHAR(4000) AS
BEGIN
 
 RETURN REPLACE(@String, '''', '''''')
 
END

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
C++Write a program that will prepare a shipping label and determine the cost for a box of any size and mass. five attributes: type double length, width, height, mass, price six attributes: type string senderName, receiverName, senderAddress, receiverAddress, originCountry, destinationCountry (you can shorten names if you like, just make a comment about their meaning) a default constructor – basic initial values for all parameters a user constructor – input sender Name, senderAddress, originCountry a double function volume() – a function to return l×w×h a double function surfArea() – a function to return 2×(l×w+l×h+w×h) a double function girth() – a function to return the perimeter for the two smallest dimensions P=2(x+y), where x and y are the two smalles of l,w,h a double function maxDim() – a function to return the largest dimension from l,w,h a double function pricing() – a function to return the shipping price based on the table above an operator+ function – a function that determines the total cost of shipping (return type double).... (you may decide how to calculate.... a) add prices from both packages, b) apply fee or discount for number of packages) an operator>> function – a function to get the information from the user about the package.... OR.... a set of “ask” functions to ask the same information an operator<< function – a function to type the information in the shipping label format.... OR.... a set of “print” functions – to print the same information
最新发布
06-01
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值