Viewing 15 posts - 496 through 510 (of 2,171 total)
Here is an interesting approach for moving average
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=93911
In that topic, set-based solution beat all other tehniques for moving average.
March 3, 2009 at 2:56 am
Try this
SELECTglbbm.gl_client_id AS [Client Id],
glbbm.gl_business_unit_id AS bu_val,
glbbm.gl_object_account AS obj_ac_val,
glbbm.gl_subsidiary_account AS subsid_ac_val,
glbbm.gl_fiscal_year AS fisc_yr_val,
glbbm.gl_type_code AS ledg_type_cd,
glbbm.gl_currency_code AS currcy_cd,
company.coy_fiscal_calendar_pattern_code AS fisc_pattn_cd_val,
bu.bu_name AS [Property Name],
bu.bu_region_code AS bu_cat_02_cd,
bu.bu_property_category_03_code AS bu_cat_03_cd,
bu.bu_region_name AS Region,
bu.bu_property_category_03_name AS [Property...
March 3, 2009 at 2:45 am
Something went wrong when Query Engine delivered Query Tree to Storage Engine?
February 13, 2009 at 7:22 am
It would help if you posted the view definition.
Maybe something is seriously wrong there?
SELECTSUM(Amount)
FROMvwCashTransactions
WHEREGroupAccountID = @P1
AND LedgerDate BETWEEN @P2 AND @P3
February 13, 2009 at 3:07 am
As told in other thread, you don't need doubled nested cursors.
All it takes is one update statement and one insert statement.
February 11, 2009 at 8:42 am
Either you actually have a hierarchy of 100 levels or more, or you have a case of circular reference which is more likely.
February 10, 2009 at 12:49 am
Thanks!
Corrected. I orignally posted p.* but changed it becuase I don't like * in production code.
Obvously I wasn't focused enough.
February 6, 2009 at 7:24 am
Completely random
DECLARE @Sample TABLE
(
ID INT IDENTITY (1, 1) PRIMARY KEY CLUSTERED,
bit01 BIT NOT NULL,
bit02 BIT NOT NULL,
bit03 BIT NOT NULL,
bit04 BIT NOT NULL,
bit05 BIT NOT NULL,
bit06 BIT NOT NULL,
bit07 BIT...
February 6, 2009 at 3:52 am
CREATE FUNCTION dbo.fnRandomNames
(
@uuid UNIQUEIDENTIFIER
)
RETURNS NCHAR(10)
AS
BEGIN
RETURN(
SELECT TOP 1Name
FROMdbo.TestNames
WHEREID = 1 + ABS(CHECKSUM(@uuid)) % 1000
)
END
UPDATETBL_PATIENT
SETFirst_NAME = dbo.fnRandomNames(NEWID())
February 6, 2009 at 3:28 am
If it works for you, great.
But you should consider rewriting the code as set-based instead.
February 6, 2009 at 12:09 am
SET NOCOUNT ON
???
The only DML returning a resultset is SELECT (without INTO).
February 5, 2009 at 2:54 am
I don't think you need a recursive function for this.
Please post your table structure and some proper sample data.
Also post your expected result.
February 5, 2009 at 2:52 am
Let these links end this discussion
SQL Server 2005
http://msdn.microsoft.com/en-us/library/ms143432(SQL.90).aspx
SQL Server 2008
http://msdn.microsoft.com/en-us/library/ms143432.aspx
SQL Server 2000
http://msdn.microsoft.com/en-us/library/aa933149(SQL.80).aspx
February 5, 2009 at 12:42 am
Viewing 15 posts - 496 through 510 (of 2,171 total)