|
Id Credit Debit CurrentCredit Current Debit
51 21500 0 21500 0
52 0 21500 0 0
89 0 2150 0 2150
93 0 2140 0 4290
128 2140.5 0 0 2149.5
129 2151.5 0 2 0
171 0 1628 0 1626
190 1628 0 2 0
i have column of credit and debit and want to get columns of current credit and current debit
example:
51. credit=21500 and debit=0
i have credit more than debit so this increase credit and decrease debit
then
current credit = 0+21500
52. credit=0 and debit=21500
i have debit more than credit so this decrease credit and increase debit
then current credit =0 and current debit =0
89 credit=0 and debit =2150
i have debit more than credit so this decrease credit and increase debit
then current credit =0 and current debit=0+2150=2150
93 credit=0 and debit =2140
i have debit more than credit so this decrease credit and increase debit
then current credit =0 and current debit=2140+2150= 4290
and so on...
|
|
|
|
|
That's very interesting. Is there a question in there?
|
|
|
|
|
Are you just looking for this?
SELECT SUM(CurrentCredit) - SUM(CurrentDebit) AS FinalBalance FROM myTable
|
|
|
|
|
As interesting as your data is, what is your query?
"My interest is in the future because I'm going to spend the rest of my life there." - Charles F. Kettering
|
|
|
|
|
Hi
I have a table with duplicate rows and distinct id. I have written a select query using distinct and selecting only required fields to avoid duplicates.
Select dictinct(occassion), startdate from table1
Now what i want is to give unique row number to each distict row
For this i tried as below but could not succeed
Declare @num int
set @num =0
select (set @num = @num+1) as num,
dictinct(occassion), startdate from table1
After search in google , i got row_number(). But this i am unable to use as i am using distinct. Can u pls let me know how i can achieve this.
Thanks in advance
Naina
Naina
|
|
|
|
|
What are you going to do with the unique row number? How will it assist you? Where are you using it?
|
|
|
|
|
Hi
Thanks for the reply.
It is very useful for me. As i will use it in my web page (front end) where other functionality related to this unique number is related to.
Please help me to get this.
Regards
Naina
Naina
|
|
|
|
|
Cant you just use ID in the record from table itself?
|
|
|
|
|
hi all,
would like to receive help on how to connect to a magic software database using vb.net.
thank you very much.
|
|
|
|
|
I'll bite, if you can't find something at connectionstrings.com then you need to go back to the vendor. Never heard of it before!
|
|
|
|
|
I came across Magic Software back in the early 90's, I have to say (at the time) it was very inmpressive but too expensive for the company I was employed by at the time. I haven't come across it since, so I assumed like many other companies, it had gone under. Great product, dodgy name
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
hi..
i would like to attach OR RESTORE a database TO MSDE USING VB.NET OR C#.
PLZ HELP ME OUT TO SOLVE THIS PROBLEM...
THNKS & RGDS
AGEESH
|
|
|
|
|
I would help but I have never used MSDE, isn't this a forerunner to sql server express? Looks like some likely responses with this search[^]
|
|
|
|
|
Hi,
I am using sqlserver 2008, How can I calculate the total memory occupied by the Database with tables (>30) and also data in it.
I mean if I have DB (DB_name) and with few tables(tblabc, tbldef......) with data in it, how to calculate the total memory occupied by the database in the server.
Kindly Help me.
Thanks
Ramm
|
|
|
|
|
Like this:
use YourDBName
SELECT size FROM sys.database_files
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
Hi D@nish,
I executed the query, it showed, 1408 and 2768 without data in database.
even with data it showd the same numbers.
please help me.
Thanks
Ramm
|
|
|
|
|
Well have a rat around the management studio, sysobjects also has lots of info.
Take a look at the system views, they are design to give you info on your databases.
|
|
|
|
|
Right Click your database in Object Explorer, Select Reports - Standard Reports - Disk Usage
explore these reports for common reqs.
I don't speak Idiot - please talk slowly and clearly
I don't know what all the fuss is about with America getting it's first black president. Zimbabwe's had one for years and he's sh*t. - Percy Drake , Shrewsbury
Driven to the arms of Heineken by the wife
|
|
|
|
|
Size is the size of mdf and ldf file in 8K pages. Divide the value by 128 to get the size in MB.
It might come same with/without data depending upon the amount of data your DB holds.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
Hi,
Hi,We are migrating our DB from MS Access to SqlServer 2005. So could anybody please let me know how to copy the data in MS Access tables, first to an XML file and then to a table in Sql Server 2005, using C# as programming language and .NET 2005 as platform.
Thanks & Regards
Puneet
|
|
|
|
|
What happenned to your migrate from Access to SQL - what you are trying is not the best way of doing it.
If you assume that SQL Server can read a datatable written as an xml file you could read the table into the client C# and wtrite it out using datatable.writexml(filename)
|
|
|
|
|
i've installed sql server in windows authentication.I want to change the authentication mode to sql sever..How can i do this without reinstallation?
|
|
|
|
|
I thoight that was a setting on the database not the server - nope just checked.
I can change it in Management studio 2005+, you may need to use a script to change it in 2000. Can you right click on the server in QA and get the properties of the database?
|
|
|
|
|
Start 'SQL Server Enterprise Manager"
Right click on your server and choose properties
Select the Security tab and do you configuration.
Wout Louwers
|
|
|
|
|
Hi,
We are migrating from MS Access to SqlServer 2005. Could anyone please let me know how to copy tables and other objects (Stored procedures, triggers) from our current Access Database to SqlServer 2005.
Thanks & Regards
Puneet
|
|
|
|