Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Usage of DISTRIBUTED

Author  Topic 

Kalaiselvan
Posting Yak Master

112 Posts

Posted - 2013-08-13 : 01:27:40
Hi,
I have gone thru some SQL Websites for SQL Bulk Data Transaction. There I have got some Query, And I have tried using that. But Stucked with DISTRIBUTED BY Keyword.
Need to know about Distributed Method in SQL and the Below Query Usage..

Table [trans_data]
[Order_Id][ITEM]
order 1 item 1
order 1 item 2
order 1 item 32
order 2 item 3
order 2 item 2
order 2 item 5
order 3 item 3

CREATE TABLE Trans_01 AS
SELECT item, SUM(1) AS cnt
FROM trans_data
GROUP BY item
HAVING SUM(1) > 5
DISTRIBUTED BY (item)

The above query getting an error with Incorrect syntax near the keyword 'DISTRIBUTED'.
Please help to Learn about Distributed in SQL server and above Query Usage.

Regards,
Kalai

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2013-08-13 : 10:47:14
I've never seent that syntax and I don't think it is valid in SQL Server. Do you have a link for where you saw this syntax?
Go to Top of Page

Kalaiselvan
Posting Yak Master

112 Posts

Posted - 2013-08-14 : 00:22:39
http://picksesame.blogspot.in/2011/01/market-basket-analysis-using-sql.html

Regards,
Kalai
Go to Top of Page

djj55
Constraint Violating Yak Guru

352 Posts

Posted - 2013-08-14 : 09:00:16
Remember T-SQL does not use all the same commands as SQL.

djj
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2013-08-14 : 15:58:09
quote:
DISTRIBUTED BY (column, [ ... ] )
DISTRIBUTED RANDOMLY
Used to declare the Greenplum Database distribution policy for the table. DISTIBUTED BY uses hash distribution with one or more columns declared as the
distribution key. For the most even data distribution, the distribution key should be the primary key of the table or a unique column (or set of columns). If that is not
possible, then you may choose DISTRIBUTED RANDOMLY, which will send the data round-robin to the segment instances. If not supplied, then hash distribution is
chosen using the PRIMARY KEY (if the table has one) or the first eligible column of the table as the distribution key.



Microsoft SQL Server MVP, MCT, MCSE, MCSA, MCP, MCITP, MCTS, MCDBA
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2013-08-14 : 16:00:56
http://media.gpadmin.me/wp-content/uploads/2011/05/GP-4100-AdminGuide.pdf

It seems DISTRIBUTED BY has the equivalent in Microsoft SQL Server (T-SQL) with " OPTION (HASH GROUP). "



Microsoft SQL Server MVP, MCT, MCSE, MCSA, MCP, MCITP, MCTS, MCDBA
Go to Top of Page
   

- Advertisement -