Viewing 15 posts - 121 through 135 (of 283 total)
Yes, you can add role-based intelligence inside the function, or you could have different functions and control access to them through roles. Personally, I prefer the latter method as I...
April 22, 2008 at 1:03 pm
yuryn1961 (4/21/2008)
SELECT COALESCE(NULLIF(CUST_NAME_RU, ''), CUST_NAME_EN) AS CUST_NAMEFROM [CUSTOMERS]
Why use Coalesce and IsNull (I assume that's what NULLIF really is)? Actually, the code above is not going to give you what...
April 22, 2008 at 12:33 pm
I don't know why you just couldn't use:
select * from dbo.function1( '2007-12-01', '2007-12-31' )
instead of wrapping the function (itself a wrapper) inside a view.
Your problem is that there is no...
April 22, 2008 at 11:20 am
No problem. To set to beginning of the current month:
set @BeginDate = DateAdd( mm, DateDiff( mm, 0, GetDate()), 0 );
To set to beginning of the current year:
set @BeginDate = DateAdd(...
April 17, 2008 at 11:18 am
-- For 2005 and later
Create Procedure InsertRows
@NumberOfRows tinyint
as begin
INSERT INTO User_Group_Map
...
April 16, 2008 at 7:24 pm
Do you mean something like this:
Create PROCEDURE [dbo].[usp_ReportGlassStatsWeb]
@StartDate datetime = null, -- Allow a null value
...
April 16, 2008 at 7:07 pm
If I may put in my 2 cents.
ALTER FUNCTION [dbo].[PostArea](
@lcPostcode VARCHAR(4))
RETURNS VARCHAR(2)
Are you certain that a function that strips digits from a string will only ever...
April 11, 2008 at 2:10 pm
You have to force a null value for empty days, that's what a Tally or Numbers table does well. Then just some GROUP BYs and you don't need a DISTINCT,...
March 24, 2008 at 3:20 pm
Yes. But in reading your original post, I thought that's what you wanted when you said, "regardless if they have data for them."
March 19, 2008 at 5:20 pm
Oops. One of those oversights that could go a really long time before manifesting itself. :blush:
However, I still like the join better. It's simple and easy to maintain -- and...
March 19, 2008 at 5:12 pm
For what it's worth, here's my entry:
create function ExtractDigits (
@Pattern varchar( 8000 )
)
RETURNS varchar( 8000 )
as begin
declare @Result varchar( 8000 );
select @Result = '';
select @Result...
March 19, 2008 at 5:03 pm
Am I missing something or are you guys making this much more difficult than it should be? In general, you can do this:
select <column list>
from whatever-to-get-original-resultset
union
select <column...
March 19, 2008 at 3:31 pm
Here is a function we wrote based on info posted here and elsewhere:
/*
This function will return the number of rows in a table, the same result
as executing a "Select Count(*)...
March 19, 2008 at 3:22 pm
Both pseudo tables exist for every trigger. Here is a code snippet I include in every multiple-operation trigger:
if @@RowCount = 0
...
March 19, 2008 at 3:10 pm
Having this in the insert trigger shouldn't be too bad.
Create trigger trg_Name
on Customers after insert as
...
insert into DistinctTable(Name)
select i.Name
from inserted i
left join...
March 19, 2008 at 2:57 pm
Viewing 15 posts - 121 through 135 (of 283 total)