Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2005 > SQL Server 2005
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
SQL Server 2005 General discussion of SQL Server *2005* version only.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2005 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 6th, 2011, 12:45 PM
Authorized User
Points: 134, Level: 2
Points: 134, Level: 2 Points: 134, Level: 2 Points: 134, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2009
Posts: 30
Thanks: 9
Thanked 0 Times in 0 Posts
Default Linear functions in SQL 2008

Hello,

Anyone having idea about the linear regression functions in SQL 2008 like LINEST in EXCEL? Or any function for SLOPE & INTERCEPT? Or any function created for this will be helpful.

Thanks in advance for any help.

Regards,
Narendra
Reply With Quote
  #2 (permalink)  
Old April 7th, 2011, 01:07 AM
Friend of Wrox
Points: 2,473, Level: 20
Points: 2,473, Level: 20 Points: 2,473, Level: 20 Points: 2,473, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2004
Location: India
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts
Default

I think these are not available in SQL server
Please check the following for some of the options:
http://knol.google.com/k/linus-nilss.../g1yluc4toyn/8
__________________
Om Prakash Pant
Click the "Thanks" button if this post helped you.
Reply With Quote
The Following 2 Users Say Thank You to om_prakash For This Useful Post:
Narendra.Patil (April 7th, 2011)
  #3 (permalink)  
Old April 7th, 2011, 03:04 AM
Authorized User
Points: 134, Level: 2
Points: 134, Level: 2 Points: 134, Level: 2 Points: 134, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2009
Posts: 30
Thanks: 9
Thanked 0 Times in 0 Posts
Default

Thanks Om,

I also got some info on net. Need to create SQL UDF.


set nocount on
declare @n int
create table #lr (x real not null, y real not null)
--insert sample data
insert into #lr values (2005,5.620400866)
insert into #lr values (2006,5.638354669)
insert into #lr values (2007,5.659482216)
insert into #lr values (2008,5.676753802)
insert into #lr values (2009,5.697093487)
select @n=count(*) from #lr --this is just for convenience, you can substitute count(*) for @n in the code
--meat of the code begins here
select
((@n * sum(x*y)) - (sum(x)*sum(y)))/
((@n * sum(Power(x,2)))-Power(Sum(x),2)) AS Slope,
avg(y) - ((@n * sum(x*y)) - (sum(x)*sum(y)))/
((@n * sum(Power(x,2)))-Power(Sum(x),2)) * avg(x) as Intercept
from #lr
drop table #lr
Reply With Quote
  #4 (permalink)  
Old April 7th, 2011, 03:19 AM
saymamohib28
Guest
 
Posts: n/a
Default erp definiton

erp definiton
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Synchronization between SQL 2008 Express on local machine and SQL hosting server avidan ASP.NET 4 General Discussion 0 December 29th, 2010 12:31 PM
Has anyone got this working with VWDE 2008 / SQL Express 2008? john77 BOOK: ASP.NET 3.5 Website Programming Problem Design Solution 4 January 18th, 2010 01:16 PM
SQL 2008 will not run on Windows 2008? dkrus Book: Professional Microsoft SQL Server 2008 Administration ISBN: 978-0-470-24796-9 1 February 23rd, 2009 12:34 PM
Solve Linear Equation in XSLT waqasnet XSLT 2 November 10th, 2008 02:34 PM
Linear programming problem milk_vanilla Excel VBA 5 August 25th, 2005 09:06 AM



All times are GMT -4. The time now is 10:26 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.