Viewing 15 posts - 4,081 through 4,095 (of 5,502 total)
You could join it to either a solid calendar table or buid one on the fly and do a left join on it.
Something like
;WITH
calendar_yr AS
(
SELECT 2009 AS yr UNION...
March 4, 2010 at 12:36 pm
Please don't cross post.
Discussion already started here
March 4, 2010 at 12:27 pm
adams.squared (3/4/2010)
where datediff(mm, OrderDate, getdate())<=13
edit: Mine will include the whole month, so for today it would have 13 months and 4 days...
March 4, 2010 at 10:41 am
Would it be possible to use views that will exclude the rows/columns they're not allowed to change and grant update permission to that view?
That still would prevent accessing your main...
March 4, 2010 at 10:39 am
SELECT col
FROM table
WHERE orderdate >= DATEADD(month,-13,getdate())
AND orderdate < getdate ()
or, if you'd need to include the full month:
SELECT col
FROM table
WHERE orderdate >= DATEADD(month,DATEDIFF(month,0,getdate())-13,0)
AND orderdate < getdate ()
March 4, 2010 at 10:32 am
What is the best way to check and prevent updates when done by outside tools like these ?
If you want to prevent updates done other than via your stored procedure...
March 4, 2010 at 10:13 am
rockingadmin (3/4/2010)
i have wasted lot of time and struggled for this logic. finally i got the solution which was same as you said. but i didn't mention...
March 4, 2010 at 10:03 am
I'm not sure if this would give you the same result since there are no data available to test again...
SELECT
CASE
WHEN b.userid IS NOT NULL AND b.appId=1 AND CHARINDEX('%',a.permissionval)=1...
March 4, 2010 at 9:40 am
March 4, 2010 at 9:25 am
Please provide some sample data to play with.
The best way to post sample data is described in the first link in my signature.
March 4, 2010 at 9:23 am
Thamizh (3/3/2010)
I have a Decimal column.I'm not authorized to change the column data type.My data will be positive or negative value.What i need is, if the value will...
March 4, 2010 at 3:04 am
Well, since we just figured that the code is actually working, change the print statement to EXEC(@SQL).
Post the error message (if there is one...).
Again, it's running just fine on my...
March 3, 2010 at 4:48 pm
Ok,
now change the value of @DESDB to your target db (or tempdb, if you want).
Run the script again. Copy the result into a new query windo and run it. Post...
March 3, 2010 at 4:37 pm
Please run the following code and post the first 8 (eight) lines of code.
It will only print the SQL statement, not execute it. I added USE MASTER to protect your...
March 3, 2010 at 4:30 pm
Glad it worked out for you 😀
Once you figured how ROW_NUBER and its sibling (RANK and DENSE_RANK) work, all come in really handy. 😉
March 3, 2010 at 4:23 pm
Viewing 15 posts - 4,081 through 4,095 (of 5,502 total)