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...
Skip.
Not sure if normalised data would help here,
Person 1 has 5 items of data
person 2 has 3 itmes of data
Person 3 has 2 items of data
If he has 5 place holders in the e-mail template and there is only data for 3 then the other 2 will remain empty and will display a blank line.
What I...
Have a look at the ROLLUP clause as part of your group by
Select Col1, Col2 sum(Col3)
From YourTable
Group By Col1, Col2 WITH ROLLUP
I love deadlines. I like the whooshing sound they make as they fly by
Douglas Adams
(1952-2001)
You could rig something up using
sys.columns and sys.objects which would return tables that have column names matching a string then I guess you could create some Dynamic SQL from there to run your selects.
I love deadlines. I like the whooshing sound they make as they fly by
Douglas Adams...
I need to check 20 columns in th esame table for any 1 of 15 differnet codes.
I can obviously do it with a very messy nested casae statement but can anyone think of a neater/more efficient version?
Cheers
I love deadlines. I like the whooshing sound they make as they fly by
Douglas Adams...
I currently have a large number of lookups, some are being done within scripts as case statements and some using lookup tables.
I'm thinking about changeing them all to use a lookup table to make the maintenance easier etc but just a quick question.
Is it better to use a seperate table for...
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.