Viewing 13 posts - 1,426 through 1,438 (of 1,438 total)
Afraid so, 'WITH' is SQL Server 2005 only and is used for CTEs (common table expressions).
October 30, 2007 at 9:58 am
with CTE1 as
(select EmpID, LocationID,
count(*) over(partition by EmpID,LocationID) as cn,
sum(Amount) over(partition by EmpID) as...
October 30, 2007 at 9:47 am
If you register your 32 bit VB6 COM object as a COM+ component you should be able to instantiate it in SQL 2005 x64
October 27, 2007 at 2:41 am
To be honest I wouldn't use any, instead I'd use a range table such as below, avoids hardwiring values
create table Ranges(GrossPayMin decimal(10,3) not null,
...
October 26, 2007 at 12:51 pm
Maybe this
WITH CTE AS
(SELECT ID, CUSTPHONENO, EVENTTIME, DUEDATE, ASSIGNEDFORDATE,
ROW_NUMBER() OVER(PARTITION BY ID ORDER BY EVENTTIME DESC) as rn
FROM tbl_table1)
SELECT ID, CUSTPHONENO, EVENTTIME,...
October 25, 2007 at 12:45 pm
Try searching for "InitCap"
Here's a simple C# implementation
using System;
using System.Data;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using Microsoft.SqlServer.Server;
using System.Globalization;
public partial class UserDefinedFunctions
{
[Microsoft.SqlServer.Server.SqlFunction]
public static SqlString InitCap(SqlString...
October 25, 2007 at 8:05 am
You can avoid looping by using a numbers table
declare @s-2 varchar(100)
set @s-2='aa,bb,cc,dd,ee,ff,gg,hh,ii,jj';
with cte as
(select Number,row_number() over(order by Number) as occurance
from Numbers
...
October 25, 2007 at 6:31 am
Using a table of numbers as in
DECLARE @STR VARCHAR(100)
SET @STR='1, 2, 3, 4, 5, 50, 99 ,100'
SELECT CAST(SUBSTRING(@str,
...
October 17, 2007 at 6:58 am
Here's another way
SELECT R_id,ProductCode,FilterDesc,RowsCount,FilterCount,
SUM(RowsCount) OVER(PARTITION BY FilterDesc) AS SUMROWCOUNT
FROM @SAMPLE
October 15, 2007 at 11:48 am
Untested, but this should work
WITH CTE AS
(SELECT MCID, Date, SepCode,
ROW_NUMBER() OVER(PARTITION BY MCID ORDER BY Date DESC) as rn
FROM Employment)
SELECT MCID, Date,...
October 10, 2007 at 4:08 pm
Try this
DECLARE @RootID INT
SET @RootID=12;
WITH CTE AS(
SELECT GroupID,ParentGroupID
FROM AframeGroup
WHERE ParentGroupID=@RootID
UNION ALL
SELECT a.GroupID,a.ParentGroupID
FROM AframeGroup a
INNER JOIN CTE c ON c.GroupID=a.ParentGroupID)
SELECT GroupID
FROM CTE
ORDER BY GroupID
October 9, 2007 at 3:02 am
Here's another way
DECLARE @MyTable TABLE
(
ID INT,
RowNumber INT,
RowText NVARCHAR(20)
)
INSERT INTO @MyTable
SELECT 12, 1, 'ABC-' UNION
SELECT 12, 2, 'XYZ' UNION
SELECT 12, 3, 'DEF' UNION
SELECT 13, 1, 'ABC' UNION
SELECT 13, 2, 'DEF' UNION
SELECT...
October 5, 2007 at 5:02 am
Try this
with cte
as (select row_number() over(partition by name order by Eff_date desc) as rn
from mytable)
delete from cte
where rn>1
September 26, 2007 at 9:58 am
Viewing 13 posts - 1,426 through 1,438 (of 1,438 total)
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy