Viewing 15 posts - 8,281 through 8,295 (of 8,760 total)
If you are on Sql Server 2012 or 2014, you should definitely look into the over clause and the window functions, perfect for this type of work.
😎
May 12, 2014 at 6:08 am
Here is one way of doing this
😎
USE tempdb;
GO
CREATE TABLE #events
(
eventID int,
eventname char(30),
startdate date,
enddate date
)
INSERT INTO #events VALUES (1,'testevent 1','2014-05-02','2014-05-30');
INSERT INTO #events VALUES (2,'testevent...
May 12, 2014 at 5:13 am
Grant Fritchey (5/12/2014)
madhukars 32911 (5/12/2014)
Yes,I want to use JOINS, but this relationship is to be generated automatically on selection of the tables by the user.
Right. No way to do this...
May 12, 2014 at 4:53 am
madhukars 32911 (5/12/2014)
Hi,I want to use the existing relationship to be populated in a text box in vb.net
Thanks
Madhukar
Start by looking at these views in the database
[font="Courier New"]INFORMATION_SCHEMA.TABLE_CONSTRAINTS
INFORMATION_SCHEMA.DOMAIN_CONSTRAINTS
INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE
INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS
INFORMATION_SCHEMA.CHECK_CONSTRAINTS
INFORMATION_SCHEMA.CONSTRAINT_TABLE_USAGE[/font]
😎
May 12, 2014 at 4:34 am
madhukars 32911 (5/12/2014)
Yes,I want to use JOINS, but this relationship is to be generated automatically on selection of the tables by the user.
I don't think it is a good idea...
May 12, 2014 at 4:16 am
This is not a dynamic solution, the number of columns are set in the code.
😎
USE tempdb;
GO
DECLARE @POLHIST TABLE
(
POLICY_DETAILS_ID VARBINARY(16) NOT NULL
...
May 12, 2014 at 3:59 am
For comparison, here is a SQL 2012/2014 window function version. Without an POC index, Lynn's code is still faster.
😎
SELECT
IdCompany
,CompanyName
,CompanyCode
FROM
(
...
May 11, 2014 at 11:09 pm
Lynn Pettis (5/11/2014)
And here is an alternative solution:
And its also a better one:ermm:, probably 20% quicker than my code! Nice!
😎
May 11, 2014 at 10:05 pm
Here is a quick "translation" to play around with
😎
USE tempdb
Go
DECLARE @CHEST_COUNT INT = 1000;
/* Seed for the Inline Tally */
;WITH TN(N) AS (SELECT N FROM (VALUES...
May 11, 2014 at 8:17 pm
KGJ-Dev (5/11/2014)
Once again thank you so much for...
May 11, 2014 at 7:08 pm
KGJ-Dev (5/11/2014)
I am sorry for the error data and Thank you for the reply and query. I understand how to split. Have a question about i have 100*1000...
May 11, 2014 at 6:50 pm
If this is a fixed hierarchy, then it is straight forward. First get all distinct parent entries and the append the children. There is one error in the data, the...
May 11, 2014 at 6:20 pm
Hi David and Lynn,
thank you both for the input, I appreciate it.
Firstly, this is a valuable discussion and would merit a thread on its own.
Thanks to columnar editing in...
May 11, 2014 at 8:33 am
Jeff Moden (5/10/2014)
May 11, 2014 at 7:21 am
jeremy 64107 (5/11/2014)
I'm using SQL Server 2008 R2.
Too bad my ESP (Extrasensory perception) connection is down:-P The create table statements for both tables and the update statement sql code...
May 11, 2014 at 2:59 am
Viewing 15 posts - 8,281 through 8,295 (of 8,760 total)