|
ohh maybe you don't undestand what i posted.
I want to create folder not just print.
you can test it. It is not acept with space.
VB.Net
|
|
|
|
|
Put double quotes around the directory and file name.
Eg: "c:\Temp Folder\Temporary File.txt"
Tim
|
|
|
|
|
Thanks you so much it work well...
VB.Net
|
|
|
|
|
I'm facing the following error:
Output SqlScript: EXEC master.dbo.xp_cmdshell 'mkDir "C:\ComName\Test\Test Folder 1"' -- It works fine
But when I try like EXEC @SqlScript ,it raise the following error.
Msg 203, Level 16, State 2, Procedure spCreateF0lder, Line 19
The name 'EXEC master.dbo.xp_cmdshell 'mkDir "C:\ComName\Test\Test Folder 1"'' is not a valid identifier.
Thanks
Md. Marufuzzaman
Don't forget to click [Vote] / [Good Answer] on the post(s) that helped you.
I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.
|
|
|
|
|
Try the following hope that may helped you...
--EXEC spCreateF0lder 'C:\ComName\Test\' ,'Test Folder 1'
CREATE PROCEDURE spCreateF0lder
@DefaultPath varchar(MAX)
,@FolderName VARCHAR(100)
AS
BEGIN
DECLARE @SqlScript VARCHAR (MAX)
SET @SqlScript = 'EXEC master.dbo.xp_cmdshell ''' + ' mkDir ' + @DefaultPath + @FolderName + ''''
EXEC @SqlScript
Print @SqlScript
END
GO
Thanks
Md. Marufuzzaman
Don't forget to click [Vote] / [Good Answer] on the post(s) that helped you.
I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.
modified on Saturday, December 26, 2009 8:35 AM
|
|
|
|
|
Hi:
How can I restore data from the transaction log file in SQL Server 2005?
Please help..
|
|
|
|
|
Asuuming your backup is something like this, and you have the Database Recovery Method set to FULL::
BACKUP DATABASE TestDB
TO DISK = 'e:\backups\TestDB.bak',
WITH
FORMAT,
MEDIANAME = 'TestDB_MediaSet1'
BACKUP LOG TestDB
TO DISK = 'e:\backups\TestDB_log.bak'
WITH
FORMAT,
MEDIANAME = 'TestDB_MediaSet1'
You can restore with something like:
USE master
GO
RESTORE DATABASE TestDB
FROM DISK = 'e:\backups\TestDB.bak'
WITH REPLACE
Check these links:
Backups[^]
Transaction Log Backups[^]
Full Database Restore[^]
I don't speak Idiot - please talk slowly and clearly
'This space for rent'
Driven to the arms of Heineken by the wife
|
|
|
|
|
Hai All,
I am doing following search in SQL Server2005,
select * from table_1 where contains (text1,'"roll-over"')
Results:
1 roll
2 notify us theday you roll check .
3 notify us the day you check roll-over.
4 notify us the day you check roll over.
Could Some one tell me , is this results are right for this search?, i feel its wrong it should only return the line which is having roll-over ( 3 notify us the day you check roll-over.)
how can i use this query or modified this querey to get proper results?
thanks
Mahe
|
|
|
|
|
You can try this search:
select * from table_1 where columnname like '%roll-over%'
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
|
|
|
|
|
hvgyufg28fh38tyr78hf wrote: Could Some one tell me , is this results are right for this search?
I'm not sure, but the documentation says that punctuation is ignored;
Punctuation is ignored. I guess that you're searching for two separate terms in your query. Look through your resultset; there's 4 results that got either term.
The source for this answer is here[^], under the heading "simple_term".
Merry Christmas
|
|
|
|
|
First off, I inherited this database and its database structure, Second I am mainly a C# programmer and my database query skills are lacking and could use improvement I know that. I have avoided this bugger for a too long so now I ask the community for help.
I'll break this down to 3 parts, 1: What my DB looks like (the important stuff), 2. What I want to accomplish, 3: Where I am at.
1: Tables & relations (I can supply you with a create script and sample data, only needed fields are seen)
TABLE:CustomerAccountPayment
ID, PK, int
CusotmerID, FK, int
EntryDate, DateTimeAmount, numeric(18,2)
Void, bit
FloatingAmount, numeric(18,2) (Positive Only, means they overpaid for some reason)
Amount = sum(CustomerAcountPaymentDetail.Amount)
Total = Amount + FloatingAmount
TABLE:CustomerAccountPaymentDetail
ID, PK, int
CustomerAccountPaymentID, FK, int (CusotmerAccountPayment.ID)
InvoicePaymentID, FK, int (InvoicePayment.ID)
Amount, numeric(18,2)
IsFloat, bit (Is true when the paymentdetail is covered under the customeraccountpayment.FloatingAmount)
TABLE:InvoicePayment
ID, PK, int
InvoiceID, FK, int
PaymentMethodID, FK, int (PaymentMethod.ID)
Amount, numeric(18,2)
DateCreated, datetime
TABLE: PaymentMethod
ID, PK, int
Name, nvarchar(50)
IsCredit, bit (Identifies it is a credit charge type to account when set to 'true')
2: What i need
I have been developing a report that is a Customer account balance sheet, it shows thier current customer account balance (sum(InvoicePayment.Amount) - sum(CustomerAcocuntPayment.Total) - and what they have paid (CustomerAccountPayment) for a date range, and the age of outstanding the charges (InvoicePayments).
I need to retreive thier balance before the StartDate.
I need to retreive What they have charged and paid between the start and enddate.
I need to retreive the remainder, after EndDate.
This is all for a particular customer and the PaymentMethod.IsCredit = true. That being true means it was charged to their "Account".
3:What i got.
To determine thier current balance i do these 2 queries.
TotalCharged - TotalPaid.
TotalCharged
SELECT SUM(InvoicePayment.Amount) AS TotalCharged
FROM InvoicePayment INNER JOIN
PaymentMethod ON InvoicePayment.PaymentMethodID = PaymentMethod.ID INNER JOIN
Invoice ON InvoicePayment.InvoiceID = Invoice.ID
WHERE (PaymentMethod.IsCredit = 1)
AND (Invoice.Void = 0)
AND (Invoice.CustomerID = @CustomerID)
TotalPaid
SELECT (sum(CustomerAccountPayment.Amount) + Sum(FloatingAmount)) as TotalPaid
FROM CustomerAccountPayment
WHERE CustomerID = @CustomerID
AND Void = 0
Now the problem is that I need to make a customer sheet for October 2009. StartDate = 20091001, EndDate = 20091031.
How do I exclude InvoicePayments (these are really charges on invocies..bad name) that are covered under a customer payment made after October 2009 but include the invoice charges for october only? Meaning there is a relation between a invoicepayment and a customerpayment made in november (there could even be a voided one CustomerAccountPayment.Void = 'True')
How do I get the balance previous to October 2009?
I just can't seem to get the proper results with all my test queries (Which are numerous..) I am hoping to get a new start point for these queries from the community... I think i am missing a technique i am jsut not aware of.
Thanks,
Jordon.
|
|
|
|
|
here if you need the data between start date and end date then just pass the 2 dates (start and end).
for example in your case 20091001 to 20091031.
if you wish the data for current month
then using getdate() fucntion get the current month and date and treat as startdate and end enddate.
for example SELECT DATEPART(d,getdate())
SELECT DATEPART(m,getdate())
you will get the current month and date.
treat as your start date and end date.
in your query then
put the logic just like
SELECT SUM(InvoicePayment.Amount) AS TotalCharged
FROM InvoicePayment INNER JOIN
PaymentMethod ON InvoicePayment.PaymentMethodID = PaymentMethod.ID INNER JOIN
Invoice ON InvoicePayment.InvoiceID = Invoice.ID
WHERE (PaymentMethod.IsCredit = 1)
AND (Invoice.Void = 0)
AND (Invoice.CustomerID = @CustomerID) and DateCreated beetween @Startdate and @Enddate
hope this is fine for you.
Regards
Keyur Satyadev
|
|
|
|
|
Yes for charges that is fine to get what has been charged.
And I can do this for the customer payments on their account.
SELECT sum(CustomerAccountPayment.Amount + CustomerAccountPayment.FloatingAmount) as TotalPaid
FROM CustomerAccountPayment Inner JOIN
CustomerAccountPaymentDetail on CustomerAccountPayment.Id = CustomerAccountPaymentDetail.CustomerAccountPaymentID
Where CustomerAccountPayment.Void = 0
and CustomerAccountPayment.EntryDate BETWEEN @StartDate and @EndDate
So now i have a total for a date range. Which is fine.
But now i need to re-create the account. and show a ...i think i just figured it out.
I have been over complicating this thing for too long.
Thanks,
|
|
|
|
|
I thought i had it now i know i don't.
What i need to do is get all outstanding invoice payments and thier amounts owing for a end date. So I want to know the status of the account for October 31, 2009.
Here is how i am able to get it for what ever is in the database, now i just need to edit it for an end date.
SELECT InvoicePayment.DateCreated AS InvoicePaymentDate,
InvoicePayment.InvoiceID,
InvoicePayment.Amount,
Customer.Name,
Invoice.CustomerID,
Invoice.InvoiceNumber
FROM InvoicePayment INNER JOIN
Invoice ON InvoicePayment.InvoiceID = Invoice.ID INNER JOIN
Customer ON Invoice.CustomerID = Customer.ID INNER JOIN
PaymentMethod ON InvoicePayment.PaymentMethodID = PaymentMethod.ID LEFT OUTER JOIN
CustomerAccountPaymentDetail ON InvoicePayment.ID = CustomerAccountPaymentDetail.InvoicePaymentID
WHERE Customer.ID = @CustomerID
and (CustomerAccountPaymentDetail.ID IS NULL)
AND (Invoice.Void = 'False')
AND (PaymentMethod.IsCredit = 'True')
union
SELECT InvoicePayment.DateCreated AS InvoicePaymentDate,
InvoicePayment.InvoiceID,
InvoicePayment.Amount - SUM(case CustomerAccountPayment.Void
when 'True' then 0
when 'False' then ROUND(CustomerAccountPaymentDetail.Amount, 2)
end) AS Amount,
Customer.Name,
Invoice.CustomerID,
Invoice.InvoiceNumber
FROM InvoicePayment INNER JOIN
Invoice ON InvoicePayment.InvoiceID = Invoice.ID INNER JOIN
Customer ON Invoice.CustomerID = Customer.ID INNER JOIN
CustomerAccountPaymentDetail ON InvoicePayment.ID = CustomerAccountPaymentDetail.InvoicePaymentID INNER JOIN
PaymentMethod ON InvoicePayment.PaymentMethodID = PaymentMethod.ID INNER JOIN
CustomerAccountPayment ON CustomerAccountPaymentDetail.CustomerAccountPaymentID = CustomerAccountPayment.ID
WHERE (Invoice.Void = 'False')
AND (PaymentMethod.IsCredit = 'True')
and Invoice.CustomerID = @CustomerID
GROUP BY InvoicePayment.DateCreated, InvoicePayment.InvoiceID, Invoice.InvoiceNumber, InvoicePayment.Amount, InvoicePayment.DateCreated, Customer.Name,
Invoice.CustomerID
HAVING (SUM(case CustomerAccountPayment.Void
when 'True' then 0
when 'False' then ROUND(CustomerAccountPaymentDetail.Amount, 2)
end) <> InvoicePayment.Amount)
ORDER BY Customer.Name
This returns a list of all invoice payments that have amounts due and thier amount that is due.
The first query gets all invoice charges that don't have a customer payment for the invoice charge, that is the easy one.
The second query gets all the invoices that have a partial payment or an overpayment (could happen with old system, not with mine...but yeah they exist).
My head hurts I don't know how to filter this beast for an end date. I guess i need to run the query on customer payment/customerpaymentdetails that are already filtered by the end date. And then run this query against that, accept i don't know how, i think that is the issue, my lack of sql experience.
Jordon.
|
|
|
|
|
alright so here is my edit, that works. (Had an idea)
Is it a good idea?
SELECT InvoicePayment.DateCreated AS InvoicePaymentDate,
InvoicePayment.InvoiceID,
InvoicePayment.Amount,
Customer.Name,
Invoice.CustomerID,
Invoice.InvoiceNumber
FROM (Select * from CustomerAccountPayment where CustomerID = @CustomerID and EntryDate <=@EndDate) as CustomerAccountPayment INNER JOIN
CustomerAccountPaymentDetail ON CustomerAccountPayment.ID = CustomerAccountPaymentDetail.CustomerAccountPaymentID RIGHT OUTER JOIN
InvoicePayment INNER JOIN
Invoice ON InvoicePayment.InvoiceID = Invoice.ID INNER JOIN
Customer ON Invoice.CustomerID = Customer.ID INNER JOIN
PaymentMethod ON InvoicePayment.PaymentMethodID = PaymentMethod.ID ON CustomerAccountPaymentDetail.InvoicePaymentID = InvoicePayment.ID
WHERE (Customer.ID = @CustomerID)
AND (CustomerAccountPaymentDetail.ID IS NULL)
AND (Invoice.Void = 'False')
AND (PaymentMethod.IsCredit = 'True')
and (InvoicePayment.DateCreated <= @EndDate)
union
SELECT InvoicePayment.DateCreated AS InvoicePaymentDate,
InvoicePayment.InvoiceID,
InvoicePayment.Amount - SUM(case CustomerAccountPayment.Void
when 'True' then 0
when 'False' then ROUND(CustomerAccountPaymentDetail.Amount, 2)
end) AS Amount,
Customer.Name,
Invoice.CustomerID,
Invoice.InvoiceNumber
FROM InvoicePayment INNER JOIN
Invoice ON InvoicePayment.InvoiceID = Invoice.ID INNER JOIN
Customer ON Invoice.CustomerID = Customer.ID INNER JOIN
CustomerAccountPaymentDetail ON InvoicePayment.ID = CustomerAccountPaymentDetail.InvoicePaymentID INNER JOIN
PaymentMethod ON InvoicePayment.PaymentMethodID = PaymentMethod.ID INNER JOIN
(Select * from CustomerAccountPayment where CustomerID = @CustomerID and EntryDate <=@EndDate) as CustomerAccountPayment ON CustomerAccountPaymentDetail.CustomerAccountPaymentID = CustomerAccountPayment.ID
WHERE (Invoice.Void = 'False')
AND (PaymentMethod.IsCredit = 'True')
and Invoice.CustomerID = @CustomerID
and InvoicePayment.DateCreated <= @EndDate
GROUP BY InvoicePayment.DateCreated, InvoicePayment.InvoiceID, Invoice.InvoiceNumber, InvoicePayment.Amount, InvoicePayment.DateCreated, Customer.Name,
Invoice.CustomerID
HAVING (SUM(case CustomerAccountPayment.Void
when 'True' then 0
when 'False' then ROUND(CustomerAccountPaymentDetail.Amount, 2)
end) <> InvoicePayment.Amount)
|
|
|
|
|
Hello everyone,
I am planning on developing an accounting application, and while planning what language to use etc... I came started to think about databases, and my question is here. I need a database that can be distributed with a setup file but is still powerful enough to handle a large amount of data and multiple users accessing the database at the same time but also offers good security which is also important, so can anyone recommend me a good database? and if it is open source its much better. I was maybe thinking of using MS SQLSERVER EXPRESS 2005.
Thank you very much everyone really appreciate any help.
Regards,
Christian Pace
|
|
|
|
|
There are limitations on SQL Server Express. Check it out to see if your "large amount of data" will exceed the limits. You can consider MySQL. I have been using MySQL in my projects for a few years. I am happy with it. It's reliable, powerful, and easy to use.
|
|
|
|
|
loyal ginger wrote: There are limitations on SQL Server Express.
Too true. Check others before Express. I can only go by my experience and so have no answer as to which to pick but do not pick Access. I have nightmares over trying fix a migration from Access that did things like make zip code a float.
|
|
|
|
|
Yes but can i somehow incorporate MYSQL into my installation?
|
|
|
|
|
You may want to build into your design the flexibility of supporting multiple databases, like Oracle, MS-SQL, MySQL, etc. This way let your customer determine which database he/she will deploy your application. Do this by building a Data Access Layer that implements all of the interaction with the database in one location.
Check this article out
Implementing a Provider Independent Data Access Layer in .NET[^]
|
|
|
|
|
Yes this is really a good idea but i want to ask you one thing. This way you are "saying" that has knowledge in IT and knows how deploy a database and maintain it etc. What I would like to implement in my application is a database that is installed automatically in the system when the user installs the application so the user doesn't need to have any IT know how.
Do you understand what I am saying? and thank you for your post anyways I agree with it and its a really good idea
|
|
|
|
|
Hi All,
I am trying to do some query in my sqlite database. I wanted to get average of some number, but could not do it.
if you please can, write a sql statement that get average of some number.
"SELECT AVE(w)FROM x WHERE y = z ";
It should return the ave of all w.
thanks in advance
|
|
|
|
|
AVE is wrong. You should use AVG.
|
|
|
|
|
Hi dxlee, it is really a silly mistake. I meant to do avg not ave and I could not figure it out what was wrong.
thanks a lot.
|
|
|
|
|
I am glad I could help. I like sqlite. My electronic document manager uses sqlite and it is much faster than my previous version (which used Microsoft Access).
|
|
|
|
|