SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Usage of DISTRIBUTED
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Kalaiselvan
Posting Yak Master

India
109 Posts

Posted - 08/13/2013 :  01:27:40  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

4608 Posts

Posted - 08/13/2013 :  10:47:14  Show Profile  Reply with Quote
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

India
109 Posts

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

Regards,
Kalai
Go to Top of Page

djj55
Constraint Violating Yak Guru

USA
308 Posts

Posted - 08/14/2013 :  09:00:16  Show Profile  Reply with Quote
Remember T-SQL does not use all the same commands as SQL.

djj
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

Sweden
30109 Posts

Posted - 08/14/2013 :  15:58:09  Show Profile  Visit SwePeso's Homepage  Reply with Quote
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

Sweden
30109 Posts

Posted - 08/14/2013 :  16:00:56  Show Profile  Visit SwePeso's Homepage  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.19 seconds. Powered By: Snitz Forums 2000