Viewing 15 posts - 91 through 105 (of 130 total)
Sean Lange (10/4/2012)
raghavender.2369 (10/4/2012)
October 4, 2012 at 2:38 pm
raghavender.2369 (10/4/2012)
create table dates(todate date)insert into dates values('01-02-1988') (or) insert into dates values('1988-02-01')
select * from dates
output:
01-02-1988
I want the output in the above mentioned format,
I assume you want to store date...
October 4, 2012 at 2:33 pm
Ignacio A. Salom Rangel (10/4/2012)
haiao2000 (10/4/2012)
Jeff Moden (10/4/2012)
October 4, 2012 at 2:19 pm
Jeff Moden (10/4/2012)
October 4, 2012 at 2:00 pm
Ray M (10/4/2012)
a quick google search on "Trees in SQL" reveals tons of articles.
Joe Celko's book on the exact subject...
October 4, 2012 at 11:03 am
ChrisM@home (10/4/2012)
What are the indexes on thoee tables, specifically mytree? Try running the results of the rCTE into a #temp table and joining the other tables to it.
Chris,
There are both...
October 4, 2012 at 11:02 am
Mark-101232 (10/9/2007)
Try thisDECLARE @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
Eventually I run into performance issue when...
October 4, 2012 at 9:14 am
And if you want to avoid the natural tendency to do some sort of looping to build your dynamic sql you can do something like this.
select 'insert YourNewTable select' +...
October 3, 2012 at 2:18 pm
Now I see your point it is a really bad example I have there. My Bad.
Thanks Guys!
October 3, 2012 at 1:18 pm
Matt Miller (#4) (10/3/2012)
haiao2000 (10/3/2012)
Matt,
Actually, I know which is base and recursive parts, what I don't know is which part in that entire code triggers the retrival of data. ...
October 3, 2012 at 12:40 pm
Jeff,
Maybe that is just a quick bad example I came up with on fly, but what I meant was that table can have data like this:
parent/child
1/2
2/3
3/4
1/5...so on and so forth....
October 3, 2012 at 12:23 pm
Matt Miller (#4) (10/3/2012)
WITH TempCTE AS
(
[highlight=#ffff11]SELECT ParentID, ChildID, 0 as Depth
FROM Table1
WHERE ParentID=1 [/highlight]
UNION ALL
SELECT T1.ParentID,...
October 3, 2012 at 12:20 pm
this is code to get columns name from a table,
SELECT COLUMN_NAME FROM SourceDbName.dbo.INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='';
if you want to do all in sql, them you may have to build sql...
October 3, 2012 at 12:13 pm
Ahh - what I was missing was the actual requirements! 🙂
This may get you part-way there: http://pratchev.blogspot.com/2008/04/convert-hex-string-to-binary-string.html. You will need to efficiently deal with leading...
October 2, 2012 at 2:12 pm
TheSQLGuru (10/2/2012)
I am seriously missing something:SELECT CAST(5 AS VARBINARY(128)) --0x00000005
SELECT CAST(0x00000005 AS bigint) --5
SELECT dbo.ConvertBigIntToVarBinary1(5) --0x010001
SELECT CAST(0x010001 AS bigint) --65537
NAH! you aren't missing anything. it was just our requirements written...
October 2, 2012 at 11:13 am
Viewing 15 posts - 91 through 105 (of 130 total)