Viewing 15 posts - 631 through 645 (of 2,171 total)
SELECT *
FROM Employees
ORDER BY PARSENAME(REPLACE(Name, ' ', '.'), 1)
November 13, 2008 at 7:11 am
Do you really want a primary key, or a unique key?
November 13, 2008 at 7:01 am
Since it seems that manager codes are always 5 characters evenly spaced at 6 positions, try this
DECLARE@Sample VARCHAR(8000)
SET@Sample = '~00ZFJ~00764~0030D~00492~00Z59~0089A~00Z7R~0070A~00ZG7~00Z4Y~0020A~0021A~00617~00293~00ZKL~00212~00ZFA~00185~0003N~0068A~00ZFK~00321~00573~00375~00Z4M~0025A~00312~00146~'
SELECTtheCode
FROM(
SELECTSUBSTRING(@Sample, 6 * Number + 2, 5) AS theCode
FROMmaster..spt_values
WHEREType = 'P'
)...
November 12, 2008 at 4:06 am
Check security rights on temp directory, since file is created there before attached to message.
November 11, 2008 at 1:56 am
Well... sp_crosstab is not my code so you will have to ask that author.
November 10, 2008 at 1:13 pm
No. You can also have
SELECT *
INTO Table1
FROM #Rows
at the end of the stored procedure.
November 10, 2008 at 12:52 pm
INSERT Table1
EXEC dbo.CrossTabProcedure ...
November 10, 2008 at 11:51 am
It depends on the purpose for knowing the length.
LEN on unicode strings only gets the number of characters and omits trailing spaces.
DATALENGTH on unicode strings get the number of bytes...
November 10, 2008 at 1:59 am
You can partition the table.
See http://weblogs.sqlteam.com/peterl/archive/2008/06/12/Horizontal-partitioning-Enterprise-style.aspx
November 10, 2008 at 1:57 am
UNIQUEIDENTIFIER is a 16-byte GUID.
It is stored binary.
November 10, 2008 at 1:54 am
Why can sales be less than zero?
If you have many returns you can. Especially early in the year when every one returns their crappy christmas gifts.
November 7, 2008 at 8:53 am
CREATE INDEXIX_ContractHistory ON dbo.ContractHistory
(
EODDate DESC,
Action,
ContractNo,
Branch,
CcyCode,
WHCode,
RateCurveID
) ON [PRIMARY]
SELECT*
FROMdbo.ContractHistory
WHEREeodDate >= '20080902'
AND eodDate < '20080903'
AND (Action = 'delete' OR Action = '')
November 7, 2008 at 5:59 am
DECLARE@Sample TABLE
(
date1 varchar(10)
)
INSERT@Sample
SELECT'10.12.2006' UNION ALL
SELECT'10-12-2006' UNION ALL
SELECT'10/12/2006' UNION ALL
SELECT'10\12\2006' UNION ALL
SELECT'10 10 2006' UNION ALL
SELECT'10 10 06'
SELECTtheDate,
ISDATE(theDate)
FROM(
SELECTSUBSTRING(date1, 7, 4) + '-' + SUBSTRING(date1, 4, 2) + '-' + SUBSTRING(date1, 1,...
November 7, 2008 at 1:47 am
This is even simpler
-- Prepare sample data
DECLARE@Sample TABLE
(
data VARCHAR(20)
)
INSERT@Sample
SELECT'1000' UNION ALL
SELECT'bb' UNION ALL
SELECT'AA1000' UNION ALL
SELECT'2008-20000' UNION ALL
SELECT'2009@20000'
-- Show the expected output
SELECTdata,
LEFT(data, pos) AS part1,
SUBSTRING(data, pos + 1, 20) AS part2
FROM(
SELECTLEN(data)...
November 7, 2008 at 1:43 am
Why create a second index almost identical as your composite primary key?
November 7, 2008 at 1:37 am
Viewing 15 posts - 631 through 645 (of 2,171 total)