here is a quick attempt.
/*
DROP TABLE person
DROP TABLE phone
CREATE TABLE person (id int,[last] VARCHAR(50),[first] VARCHAR(50))
CREATE TABLE phone (id int,personid INT,phonetype INT,phonenumber VARCHAR(50))
INSERT INTO person VALUES ( 1, 'ZZZ', 'AAA' )
INSERT INTO person VALUES ( 2...
There should be a login to connect to the database instance (via nt or sql authentication).
In order to access a particular database that login is then mapped to a database user.
The N merely lets you/sqlserver now that the string is a unicode type.
USE [master]
GO
--First Create the login...
I am not sure there is anything that will allow you to do this out of the box. I have set up a server wide ddl trigger to capture developer changes ;p
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
USE [xxxx] --replace XXXX for insert also ;p
CREATE TABLE [dbo].[DDL_Server_Log](...
(Depending on version of sql2k5+.) There is an inbuilt report called 'Schema Change History' which runs the following:
begin try
declare @enable int;
select top 1 @enable = convert(int,value_in_use) from sys.configurations where name = 'default trace enabled'
if @enable = 1
begin...
Another option would be to lock the box down via a firewall change e.g only connections from ThisAppBox can get to ThisDatabaseBox. Again if your users can get on the AppBox you have problems ;p
no blank dates wont cause the issue.
do you still get an error if you run:
SELECT
CONVERT(datetime, invo.[grn posted], 103),
CONVERT(datetime, invo.[statdeldte], 103)
FROM dbo.ZSPO AS invo
it looks like you have at least 2 rows of bad dates, it looks like we dont have the bits we need tho as we should have four columns per row.
need to change it too
ISDATE([GRN Posted]) AS Expr1,
[GRN Posted],
ISDATE(StatDelDte) AS Expr2
[StatDelDte],
as it looks from the 0 that in the 3rd...
copy and paste getting the better of me there in my last query. couple of duplicate lines ;p
double check that there are only valid dates in your table, even tho they may look valid:
SELECT
ISDATE(invo.[grn posted]) ,
invo.[grn posted],
ISDATE(invo.[statdeldte])
invo.[statdeldte],
FROM...
wow, thats some nasty code.
assuming all the comparisons are correct, and it is structured the way it should be ( bit hard to read ;p ), it will probably be some rogue data.
try the following and see if it errors, at least it will guide you.
SELECT...
if you take off the quotes,sql will ask you what it is, and most likely tell you that the column isnt there:
SELECT 'A10730'
SELECT A10730
...
In my initial post I have stripped off the 'A' (although this will all be dependant on your data, as to what you need to do)
I am then comparing the...
it depends on the data you are storing. below is one answer, but you could strip out all chars, or look for the first char moving from right to left etc.
DECLARE @tbl TABLE (items VARCHAR(50))
INSERT INTO @tbl VALUES ('A10710')
INSERT INTO @tbl VALUES ('A10711')
INSERT INTO @tbl VALUES...
if you want to go back 13wks:
[code]
WHERE dt BETWEEN DATEADD(wk,-13,@varDT) AND @varDT
[code]
if you do not want to go into the previous year, then:
[code]
AND YEAR(dt) >= YEAR(@varDT)
[code]
The other thing you will need to tweak will be when you consider to be the start of your week.
sorry havent used it for a long time. its looks quite a generic error. have you tried creating a new report and trying to pull back the data? just to check its not a binding issue... at least if that works you can narrow it down ;p
ok looks like the cartesian product is a bit large for the history_entry and tech so best to filter them down before hand. I guess you have loads of techs and history entries.
I have added a WHERE Entry_date >= '20100101' but you may be able to remove this depending on speed.
try below, and...
The only bit that you should need is at the end, and should group the totals by client and entry date.
Your group by should be:
GROUP BY C.first_name, C.Last_name, Entry_CONVERT(varchar(6),HE.Entry_date,112)
otherwise it will group based on the date time part as well.
SELECT DISTINCT...
The yr_wk can be done a little easier than you have it there.
Are you sure you have posted all the sql?
It is kind of hard without the table structure so Iam guessing a little, and you are using the old non-ansi joins.
if you come back with a little more detail with regards to table structure...
A stored procedure can provide source data for a report.
It could also repopulate data that the report was using.
It can not however start, or display ssrs reports.
you picked a strange format :P
There are several ways to achieve your end goal concatenating the date parts and adding leading zeros etc.
I would suggest if it is something that you will use in several places that you create it as a function.
Here is one way:
DECLARE @dt datetime
set @dt...
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.