Viewing 15 posts - 91 through 105 (of 125 total)
Luis Cazares (1/17/2014)
dwain.c (1/17/2014)
Dohsan (1/17/2014)
Dwain
Ándre, Ándre, Luís And O'Brien Had A Low-Budget 3D Printer In Washington D.C.
I wasn't...
January 18, 2014 at 9:56 am
Original Test strings were small (16 chars), the original function was only for 255 although a few of the functions presented have been able to handle far more. So upping...
January 17, 2014 at 3:56 am
Some excellent work
DECLARE @TestVar VARCHAR(16);
DECLARE @StartTime DATETIME;
PRINT 'Old Method Scalar Function'
SELECT @StartTime = GETDATE();
SELECT@TestVar = Utility.f_ProperCase(PT.String)
FROM#ProperTest AS PT;
PRINT...
January 17, 2014 at 3:35 am
Yes, I'll have to play around with it a little more when I have some time tomorrow.
I must say i hadn't thought about using the splitter to separate the words...
January 16, 2014 at 9:57 am
Trying to piece together some test data, some Uppercase letters with some spaces inserted:
IF OBJECT_ID('tempdb..#ProperTest','U') IS NOT NULL
DROP TABLE #ProperTest;
SELECTSTUFF(STUFF(CHAR(ABS(CHECKSUM(NEWID()))%26+65)
+ CHAR(ABS(CHECKSUM(NEWID()))%26+65)
+ CHAR(ABS(CHECKSUM(NEWID()))%26+65)
+ CHAR(ABS(CHECKSUM(NEWID()))%26+65)
+ CHAR(ABS(CHECKSUM(NEWID()))%26+65)
+ CHAR(ABS(CHECKSUM(NEWID()))%26+65)
+ CHAR(ABS(CHECKSUM(NEWID()))%26+65)
+ CHAR(ABS(CHECKSUM(NEWID()))%26+65)
+ CHAR(ABS(CHECKSUM(NEWID()))%26+65)
+ CHAR(ABS(CHECKSUM(NEWID()))%26+65)
+ CHAR(ABS(CHECKSUM(NEWID()))%26+65)
+...
January 16, 2014 at 9:51 am
dbo.GetNums is as per below, straight from one of Jeff's discussions/articles I believe:
CREATE FUNCTION [dbo].[GetNums]
(
@low AS BIGINT,
@high AS BIGINT
)
RETURNS TABLE WITH SCHEMABINDING
AS
RETURN
WITH
L0 ...
January 16, 2014 at 9:37 am
Think I may have figured it out:
CREATE FUNCTION [dbo].[ProperCase]
(
@StrIn VARCHAR(255)
)
RETURNS TABLE WITH SCHEMABINDING
AS
RETURN
SELECTProperCaseString = (
(SELECTCASE
WHEN GN.N = 1 THEN UPPER(SUBSTRING(@StrIn,GN.N,1))
WHEN SUBSTRING(@StrIn,GN.N-1,1) IN (' ','-','''') THEN UPPER(SUBSTRING(@StrIn,GN.N,1))
ELSE LOWER(SUBSTRING(@StrIn,GN.N,1))
END AS [text()]
FROMdbo.GetNums(1,ISNULL(LEN(@StrIn),1)) AS...
January 16, 2014 at 9:08 am
I'd like to point out this is a SQL 2008 forum, but the following should work with the same caveats as before. No 2000 environment to test on though.
DECLARE @Invoice...
January 9, 2014 at 2:30 am
Although, question would be what would happen if you have 3 or more item No on one invoice.
January 9, 2014 at 2:12 am
I'd have to ask why you would need it in this format, but i think the below should get what you want
DECLARE @Invoice TABLE
(
invoic_noVARCHAR(25),
item_noCHAR(3),
invoic_qtyINT,
inv_dateDATETIME
)
INSERT INTO @Invoice (invoic_no,item_no,invoic_qty,inv_date)
VALUES('tn/0002/13-14','A12',25,'03-04-2013'),
('tn/0002/13-14','A13',04,'03-04-2013'),
('tn/0004/13-14','A13',25,'03-04-2013'),
('tn/0004/13-14','A15',04,'03-04-2013'),
('tn/0005/13-14','A16',07,'03-04-2013'),
('tn/0005/13-14','A17',04,'03-04-2013')
SELECTI.invoic_no,
I.item_no,
--MAX(I.invoic_qty) OVER (PARTITION BY...
January 9, 2014 at 2:11 am
This sounds like a 'catch-all' query and can be achieved with dynamic SQL.
Have a look at the below for an excellent description and examples:
http://sqlinthewild.co.za/index.php/2009/03/19/catch-all-queries/
December 17, 2013 at 3:31 am
Following the theme of the article, I don't claim the idea of this to be mine, but I've found OVER functions are very handy for calculating median times.
December 5, 2013 at 3:01 am
You're passing a string as an argument rather than the column name. Remove the Apostophes i.e. CustomerName instead of 'CustomerName'
November 29, 2013 at 4:53 am
Raunak Jhawar (11/7/2013)
Also, you can design error handling like this:
Thanks Raunak, I've only had time to quickly flick through this, but I think this may go some way to achieving...
November 7, 2013 at 2:15 am
I believe the algorithm for calculating the check digit takes the difference between the 'weighted sum' and the nearest multiple of 10 that is equal or higher.
if the sum was...
February 28, 2013 at 1:54 am
Viewing 15 posts - 91 through 105 (of 125 total)