Both of the above answers will give you the number of weekends the item has been in stock not the number of weeks.
Datediff does not calculate the number of periods between 2 dates it gives you the number of period ends.
Example if you use DATEDIFF(YEAR, '2013-12-31', '2014-01-01') it returns...
2 Simple ways to do this either
1) Have 2 scripts 1 for each table then use the parameter to decide which script to run.
2) Use dynamic SQL to create and execute the SQL statement with the appropriate table name included.
Option 1 is the easiest to set up but ongoing there could be issues...
Should have said that this works for SQL server 2008R2.
Not sure about older versions.
I love deadlines. I like the whooshing sound they make as they fly by
Douglas Adams
(1952-2001)
Have a look at SYS.database_permission this lists all of the permissions assigned within the current database, there is also SYS.syspermissions which lists all of the permissions for the server.
Major_id links back to the id in sys.sysobjects, Grantee and Grantor principle_id's link back to the...
I'm trying ot get SSRS to populate a number of parameters from a single drop down select box
I currently have a single drop down list generated from a query that allows a user to select a specific report and it popultes the parameter @Report_ID.
I want this select to populate a number of...
We have a standard bar chart whcih sits on a single A$ Landscape sheet of paper when it is printed.
Problem is the end user can select a large number of items which run along the x-axis, this obviously causes problems whrh you come to display/print it.
Is there a way to say when the user...
Tables don't just appear in the table list in Management Studio, you need to right click and select refresh.
I love deadlines. I like the whooshing sound they make as they fly by
Douglas Adams
(1952-2001)
The error you get isn't coming from this piece of script, once you've moved the files to the destination folder what's the next step?
I would guess thats where somethign actually refers to the SQL server.
The messhge you get is beacuse of the ODBC you use to connect to the server, this exists...
If you write a script to save the attachment you can trigger the script from an outlook rule that way you can specify where the e-mail comes from etc before the script is run.
I love deadlines. I like the whooshing sound they make as they fly by
Douglas Adams
(1952-2001)
Apologies George.
Quick skim first thing in the morning before coffee.
I love deadlines. I like the whooshing sound they make as they fly by
Douglas Adams
(1952-2001)
Depends on how thay are run.
If they are run through SQL server agent than the results of the jobs are stored in th esysjonhistory table in MSDB, have a look there to start with.
use msdb
select *
from sysjobhistory
I love deadlines. I like the whooshing sound they make as they fly by...
I have a few tables of over 50 Million rows which obviously take a while to query.
From a performance point of view will a query run faster on a table that it partitioned of indexed.
For instance Financial year is a regular report variable would I be better with an index on FinYear or a table...
Mark.
George's script above will give you any columns with the appropraiate text in the column name.
Are you looking for that or do you need to find the text in individual records in a table?
I love deadlines. I like the whooshing sound they make as they fly by
Douglas Adams
(1952-2001)
SELECT MIN(ID) AS ID, myWords, chkbox1, chkbox2, chkbox3
INTO #TEMP001
FROM YOURTABLE
GROUP BY myWords, chkbox1, chkbox2, chkbox3
TRUNCATE YOURTABLE
INSERT INTO YOURTABLE
SELECT *
FROM #TEMP001
I love deadlines. I like the whooshing sound they make as they fly by
Douglas Adams...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.