|
That's what i am doing dear!
See the
BACKUP DATABASE [Outbound_Vodafone]
TO DISK = N'\\dataserver\Database\Outbound_VodafoneDifferential_9PM.bak'
WITH DIFFERENTIAL , INIT
but it's not working.
|
|
|
|
|
I really don't know much about this, but the access denied message suggests the backup is trying to do something on that disk that is restricted by permissions. You say that this disk is shared to your login, but are you sure that you have full access control on it; can you read and write and create directories etc?
It's time for a new signature.
|
|
|
|
|
Sometimes I have the same problem on some clients servers.You need to ensure that the account, SQL server is running under, has the appropriate access rights to the shared network partition. .
[EDIT]
I'm not sure but I suppose that SQL server should better be running under Network service built-in account.
[/EDIT]
Life is a stage and we are all actors!
modified on Tuesday, May 25, 2010 4:46 AM
|
|
|
|
|
Hristo Bojilov wrote: I'm not sure but I suppose that SQL server should better be running under Network service built-in account.
I believe that is the problem. I had an issue where the account running the SQL Server Agent did not have the permissions to access the other server. I changed the account but I think there is a way to impersonate for a run. Sorry I have not used this but seem to remember reading in a study guide.
|
|
|
|
|
still not get any appropriate answer.. Kindly add some more solutions.
|
|
|
|
|
Hey,
I am just wondering whelther we can generate the sql query if we already have tables. Just curious about that. If yes, how to do it ??
suchita
|
|
|
|
|
What kind of queries are you looking for? Management Studio 2008 does provides the basic structure of the statements fora table.
|
|
|
|
|
like i created one table. lets say
S.N | Name | PhoneNumb|
Now this S.N is auto increment. I am testing my project and I need to reset table many times and since this S.N is auto increment, its value just kept on increasing. So what i'm doing is just deleting the table and re-creating the table manually. So i am just wondering that if i can generate the "create" sql query for the already existed table, then once i delete that table, i can re-run that create query to create that table again. Well I can write the query and re-run it. Thats not the problem but i am just checking if there is any that feature in sql server ??
suchita
|
|
|
|
|
How are you performing the testing? If you are using test projects, make use of TestInitialize and TestCleanUp methods to clean the data up from the tables used.
|
|
|
|
|
|
Your TestCleanUp method should execute the script to clean the tables from the database.
|
|
|
|
|
But I dont know where to use that method. If i am running the aspx page, where should testinitialize method run ?? Do I need to include that in code behind or how does it work ??
suchita
|
|
|
|
|
With a little work SQL 2005 and SQL 2008 both have a GUI by right clicking the white space of the query analyzer.
Or if you just want one table you can right click the table then click SELECT TOP 1000 Rows
|
|
|
|
|
In Management Studio you can right click on any table and choose Script Table As and get a list of choices. If you choose Drop and Create that will give you the script to remove and recreate the table from scratch.
|
|
|
|
|
Thank you so much. That's exactly what I wanted.
suchita
|
|
|
|
|
sallam 2 all;
im getting return value 0 instead of getting rec
my stored proc is
SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[procCaseCategorySearch]
(
-- @CheckStatus BIT,
@Case VARCHAR,
@CaseNo VARCHAR,
@Category INT,
@CategoryID INT,
@FromDate DATETIME,
@ToDate DATETIME
)
AS
-- if @CheckStatus =1
--begin
-- true logic
IF(@Case! ='' )
BEGIN
SELECT CCSI.CS_RECEIVED_DATETIME,CCSI.CS_CASE_NO,CCSI.CS_CASE_TITLE, CCSI.CS_BILLING_COMPLIANCE_ID,
CCSI.CS_CASE_DETAIL,CCSI.CS_MAIL_ID, CCSI.CS_CASE_FROM_REP, CCSI.CS_USER_NAME,
CCSI.CS_NUMBER_OF_TIMES_CALLED,CCSI.CS_CASE_TYPE_ID,CCSI.PRIORITY_LEVEL, CCC.CS_CATEGORY_NAME,
PM.LAST_NAME + ',' + ISNULL(PM.FIRST_NAME,'') + ' [ '+ ISNULL(PM.EMAIL_ADDRESS,'') + ' ]' AS NAME,
ISNULL(PM.EMAIL_ADDRESS,'') AS PATIENT_EMAIL, CCP.CS_PRACTICE_CODE,
CCP.CS_PROVIDER_CODE,CCP.CS_PATIENT_ACCOUNT, CCP.CS_CLAIM_NO,CCP.CS_INSURANCE_CODE,
CCP.CS_RESPONSE_DATE , CCP.CS_REP_PHONE,CCP.CS_REP_PHONE_TYPE , CCP.CS_REP_EMAIL,CCP.CS_SEND_MAIL_TO,
CCP.CS_IS_SEND, CCP.CS_CREATED_DATE, CCP.CS_CREATED_BY, CCP.CS_MODIFIED_BY, CCP.CS_MODIFIED_DATE,
CCP.SHOW_ON_WEB,CCP.CS_CASE_STATUS ,CCP.CS_AUTHORIZE,CCP.CS_BILLING_COMPLIANCE , LP.PROVIDER_CODE ,
ISNULL(LP.PROVID_LNAME,'') + ',' + ISNULL(LP.PROVID_FNAME,'') AS PROVIDERNAME,
ISNULL(LP.EMAIL_ADDRESS,'') AS EMAIL_ADDRESS_PROVIDER, LPI.PRACTICE_CODE ,
ISNULL(LPI.PRAC_NAME,'') AS PRACTICENAME, ISNULL(LPI.EMAIL_CONTACT_PERSON,'') AS PRACTICE_EMAIL,
LI.INSNAME_DESCRIPTION, PT.PHONE_TYPE, LCT.CS_CASE_TYPE_DESCRIPTION
FROM CS_CUSTOMER_SUPPORT_INFO
CCSI LEFT OUTER JOIN CS_CASE_CATEGORIES CCC ON CCSI.CS_CASE_CATEGORY = CONVERT(VARCHAR(10),
CCC.CS_CATEGORY_ID) LEFT OUTER JOIN CS_CASE_PROGRESS CCP ON CCSI.CS_CASE_NO = CCP.CS_CASE_NO
LEFT OUTER JOIN PATIENT PM ON CONVERT(VARCHAR,PM.PATIENT_ACCOUNT) = CCP.CS_PATIENT_ACCOUNT
LEFT OUTER JOIN PROVIDERS LP ON LP.PROVIDER_CODE = CONVERT(BIGINT,CCP.CS_PROVIDER_CODE)
LEFT OUTER JOIN PRACTICES LPI ON LPI.PRACTICE_CODE = CONVERT(BIGINT,CCP.CS_PRACTICE_CODE)
LEFT OUTER JOIN INSURANCE_NAMES LI ON LI.INSNAME_ID = CONVERT(BIGINT,CCP.CS_INSURANCE_CODE)
LEFT OUTER JOIN PHONE_TYPES PT ON PT.PHONE_CODE = CCP.CS_REP_PHONE_TYPE LEFT OUTER JOIN CS_CASE_TYPES LCT
ON CCSI.CS_CASE_TYPE_ID = LCT.CS_CASE_TYPE_ID
WHERE CCSI.CS_CASE_NO LIKE +@CaseNo+ '%'
AND isnull(ccsi.cs_deleted,0)=0 AND ISNULL(CCP.CS_DELETED,0)=0 AND
ISNULL(CCC.CS_DELETED,0)=0 AND ISNULL(LCT.CS_DELETED,0)=0
END
--end
--else
--begin
-- false logic
ELSE IF(@Category!='')
BEGIN
SELECT CCSI.CS_RECEIVED_DATETIME,CCSI.CS_CASE_NO,CCSI.CS_CASE_TITLE, CCSI.CS_BILLING_COMPLIANCE_ID,
CCSI.CS_CASE_DETAIL,CCSI.CS_MAIL_ID, CCSI.CS_CASE_FROM_REP, CCSI.CS_USER_NAME,
CCSI.CS_NUMBER_OF_TIMES_CALLED,CCSI.CS_CASE_TYPE_ID,CCSI.PRIORITY_LEVEL, CCC.CS_CATEGORY_NAME,
PM.LAST_NAME + ',' + ISNULL(PM.FIRST_NAME,'') + ' [ '+ ISNULL(PM.EMAIL_ADDRESS,'') + ' ]' AS NAME,
ISNULL(PM.EMAIL_ADDRESS,'') AS PATIENT_EMAIL, CCP.CS_PRACTICE_CODE,
CCP.CS_PROVIDER_CODE,CCP.CS_PATIENT_ACCOUNT, CCP.CS_CLAIM_NO,CCP.CS_INSURANCE_CODE,
CCP.CS_RESPONSE_DATE , CCP.CS_REP_PHONE,CCP.CS_REP_PHONE_TYPE , CCP.CS_REP_EMAIL,CCP.CS_SEND_MAIL_TO,
CCP.CS_IS_SEND, CCP.CS_CREATED_DATE, CCP.CS_CREATED_BY, CCP.CS_MODIFIED_BY, CCP.CS_MODIFIED_DATE,
CCP.SHOW_ON_WEB,CCP.CS_CASE_STATUS ,CCP.CS_AUTHORIZE,CCP.CS_BILLING_COMPLIANCE , LP.PROVIDER_CODE ,
ISNULL(LP.PROVID_LNAME,'') + ',' + ISNULL(LP.PROVID_FNAME,'') AS PROVIDERNAME,
ISNULL(LP.EMAIL_ADDRESS,'') AS EMAIL_ADDRESS_PROVIDER, LPI.PRACTICE_CODE ,
ISNULL(LPI.PRAC_NAME,'') AS PRACTICENAME, ISNULL(LPI.EMAIL_CONTACT_PERSON,'') AS PRACTICE_EMAIL,
LI.INSNAME_DESCRIPTION, PT.PHONE_TYPE, LCT.CS_CASE_TYPE_DESCRIPTION
FROM CS_CUSTOMER_SUPPORT_INFO
CCSI LEFT OUTER JOIN CS_CASE_CATEGORIES CCC ON CCSI.CS_CASE_CATEGORY = CONVERT(VARCHAR(10),
CCC.CS_CATEGORY_ID) LEFT OUTER JOIN CS_CASE_PROGRESS CCP ON CCSI.CS_CASE_NO = CCP.CS_CASE_NO
LEFT OUTER JOIN PATIENT PM ON CONVERT(VARCHAR,PM.PATIENT_ACCOUNT) = CCP.CS_PATIENT_ACCOUNT
LEFT OUTER JOIN PROVIDERS LP ON LP.PROVIDER_CODE = CONVERT(BIGINT,CCP.CS_PROVIDER_CODE)
LEFT OUTER JOIN PRACTICES LPI ON LPI.PRACTICE_CODE = CONVERT(BIGINT,CCP.CS_PRACTICE_CODE)
LEFT OUTER JOIN INSURANCE_NAMES LI ON LI.INSNAME_ID = CONVERT(BIGINT,CCP.CS_INSURANCE_CODE)
LEFT OUTER JOIN PHONE_TYPES PT ON PT.PHONE_CODE = CCP.CS_REP_PHONE_TYPE LEFT OUTER JOIN CS_CASE_TYPES LCT
ON CCSI.CS_CASE_TYPE_ID = LCT.CS_CASE_TYPE_ID
WHERE CCC.CS_CATEGORY_ID LIKE +@CategoryID+ '%'
AND (CCSI.CS_Created_Date between '''+ @FromDate +''' AND '''+ @ToDate +''')
AND isnull(ccsi.cs_deleted,0)=0 AND ISNULL(CCP.CS_DELETED,0)=0
AND ISNULL(CCC.CS_DELETED,0)=0 AND ISNULL(LCT.CS_DELETED,0)=0
END
--end
any suggestions??????????
|
|
|
|
|
First of all install SQL Assistant programm and format this query by pressing CTRL+F11 then query will looks properly rendered.
Better check joins on query and data on tables if they match with each other.
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
www.aktualiteti.com
|
|
|
|
|
To give you some idea this is what a formatted query looks like in code blocks
SELECT
CCSI.CS_RECEIVED_DATETIME,
CCSI.CS_CASE_NO,
CCSI.CS_CASE_TITLE,
CCSI.CS_BILLING_COMPLIANCE_ID,
CCSI.CS_CASE_DETAIL,
CCSI.CS_MAIL_ID,
CCSI.CS_CASE_FROM_REP,
CCSI.CS_USER_NAME,
CCSI.CS_NUMBER_OF_TIMES_CALLED,
CCSI.CS_CASE_TYPE_ID,
CCSI.PRIORITY_LEVEL,
CCC.CS_CATEGORY_NAME,
PM.LAST_NAME + ',' + ISNULL(PM.FIRST_NAME, '') + ' [ ' + ISNULL(PM.EMAIL_ADDRESS,
'') + ' ]' AS NAME,
ISNULL(PM.EMAIL_ADDRESS, '') AS PATIENT_EMAIL,
CCP.CS_PRACTICE_CODE,
CCP.CS_PROVIDER_CODE,
CCP.CS_PATIENT_ACCOUNT,
CCP.CS_CLAIM_NO,
CCP.CS_INSURANCE_CODE,
CCP.CS_RESPONSE_DATE,
CCP.CS_REP_PHONE,
CCP.CS_REP_PHONE_TYPE,
CCP.CS_REP_EMAIL,
CCP.CS_SEND_MAIL_TO,
CCP.CS_IS_SEND,
CCP.CS_CREATED_DATE,
CCP.CS_CREATED_BY,
CCP.CS_MODIFIED_BY,
CCP.CS_MODIFIED_DATE,
CCP.SHOW_ON_WEB,
CCP.CS_CASE_STATUS,
CCP.CS_AUTHORIZE,
CCP.CS_BILLING_COMPLIANCE,
LP.PROVIDER_CODE,
ISNULL(LP.PROVID_LNAME, '') + ',' + ISNULL(LP.PROVID_FNAME, '') AS PROVIDERNAME,
ISNULL(LP.EMAIL_ADDRESS, '') AS EMAIL_ADDRESS_PROVIDER,
LPI.PRACTICE_CODE,
ISNULL(LPI.PRAC_NAME, '') AS PRACTICENAME,
ISNULL(LPI.EMAIL_CONTACT_PERSON, '') AS PRACTICE_EMAIL,
LI.INSNAME_DESCRIPTION,
PT.PHONE_TYPE,
LCT.CS_CASE_TYPE_DESCRIPTION
FROM
CS_CUSTOMER_SUPPORT_INFO CCSI
LEFT OUTER JOIN CS_CASE_CATEGORIES CCC ON CCSI.CS_CASE_CATEGORY = CONVERT(VARCHAR(10), CCC.CS_CATEGORY_ID)
LEFT OUTER JOIN CS_CASE_PROGRESS CCP ON CCSI.CS_CASE_NO = CCP.CS_CASE_NO
LEFT OUTER JOIN PATIENT PM ON CONVERT(VARCHAR, PM.PATIENT_ACCOUNT) = CCP.CS_PATIENT_ACCOUNT
LEFT OUTER JOIN PROVIDERS LP ON LP.PROVIDER_CODE = CONVERT(BIGINT, CCP.CS_PROVIDER_CODE)
LEFT OUTER JOIN PRACTICES LPI ON LPI.PRACTICE_CODE = CONVERT(BIGINT, CCP.CS_PRACTICE_CODE)
LEFT OUTER JOIN INSURANCE_NAMES LI ON LI.INSNAME_ID = CONVERT(BIGINT, CCP.CS_INSURANCE_CODE)
LEFT OUTER JOIN PHONE_TYPES PT ON PT.PHONE_CODE = CCP.CS_REP_PHONE_TYPE
LEFT OUTER JOIN CS_CASE_TYPES LCT ON CCSI.CS_CASE_TYPE_ID = LCT.CS_CASE_TYPE_ID
WHERE
CCSI.CS_CASE_NO LIKE +@CaseNo + '%' AND ISNULL(ccsi.cs_deleted, 0) = 0 AND ISNULL(CCP.CS_DELETED,
0) = 0 AND ISNULL(CCC.CS_DELETED,
0) = 0 AND ISNULL(LCT.CS_DELETED,
0) = 0
You tell me which is more readable.
I can't see anything that would stop the data being retrieved, have you checked that there is actually data in the table matching the criteria.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Very much readable
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
www.aktualiteti.com
|
|
|
|
|
diyaa_08 wrote:
IF(@Case! ='' )
BEGIN
do stuff
END
ELSE IF(@Category!='')
BEGIN
do stuff
END
I'm not really an expert on stored procedures, but what will this do if @Case is '' and @Category is ''? In that case, neither IF block will get executed. What would the stored proc return in that scenario?
|
|
|
|
|
Oh yeah, and this:
AND isnull(ccsi.cs_deleted,0)=0
Is there an advantage to doing that rather than a simple IS NULL test?
I'm not saying it's wrong, I'm saying I don't understand whether one is better than another.
|
|
|
|
|
Hello, This is Vikash Gohil.
I have a Software which is using MSDE Database (SQL2000).
When the Software is run for the first time, it checks for the database name and if not found attaches the MDF and LDF files that are present in the "<Application Path>\Data" folder.
I don't face any problem in this setup.
Now I want to move from MSDE (SQl2000) to SQLExpress (SQL2005).
I Created the MDF and LDF Files, Installed SQLExpress and My Software.
After this I Copied the MDF and LDF Files in "<Application Path>\Data" Folder.
The problem is, when I start the Software the database files are attached, but it shows below message:
"Failed To Update Database "<DatabaseName>", the Database is Read-Only."
And the software does not start.
I want to know why this happens?
I do not face such problems in MSDE.
I have Searched for this on net and found that the SqlExpress should have rights for the folder where MDF and LDF Files Exists. But I don't know how to Set rights for my "Application Path\Data" Folder.
I am totally new to SQL 2005.
Please someone can help me in this matter.
Any help would be greatly appreciated.
Awaiting a reply, Thanks in Advance.
|
|
|
|
|
Check the dumb things first.
Are the files/folder read only
Does your app have permissions on the folder (some companies set admin rights to the program files folder)
Have you set up the user correctly
Is your connection string correctly formatted
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hello, MyCroft.
Thanks for the reply.
Are the files/folder read only?
When I put the same files in the folder where system database files are present, i.e. Master, Model, etc., and then manually attach these files using Sql express Management studio, then there is no problem.
The problem of Read-Only occurs only when data files are present in some other folder.
Does your app have permissions on the folder?
During Installation of the software, we have set the permissions as Everyone, so I don't think that is the problem. Also we have been using this with MSDE the same way and there are no problems.
Have you set up the user correctly?
We Use default 'sa' user for making connections.
Also the ConnectionString is absolutely proper as it works fine with MSDE.
|
|
|
|
|
Ok so the dumb ones are covered. It still looks like 1 is the cause of the problems. If you move to another folder and attach the files does the connection work OK then. I don't use express but with SQL Server the server instance has an identity/credentials and these are used to access the file system. I would presume permissions on the data/log folders is set up on install of the database. Other folders may need specific permissions.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|