|
Use a search engine; look for concepts. Start reading.
If you have a particular question, post your code/SQL statement here and someone will probably try to help.
|
|
|
|
|
|
What is your question? Where is your code? There are not enough details here.
|
|
|
|
|
That is not a question, it is an assignment; one that is lacking enough data to complete it.
If you need to dump data from table1 into table2, I'd recommend a single "select" statement. No need for cursors there. If you are wondering how to build a cursor, I'd recommend the examples on MSDN.
You're welcome.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
TSQL - Cursor[^]
TSQL - Select statement[^]
TSQL - Insert[^]
This is some links to the msdn documentation on various method that you will need to employ to complete your task as you have stated. BUT as others have stated I would also look into the SELECT INTO commands
TSQL - Select Into[^]
if you need more help after this please post your sql statements that you have you and describe the problem that you are facing. Sadly no one will be willing to just hand you the code without any effort.
Every day, thousands of innocent plants are killed by vegetarians.
Help end the violence EAT BACON
|
|
|
|
|
Your request is rude. Consider yourself lucky you got some pointers.
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
modified 22-May-15 10:27am.
|
|
|
|
|
I want a code of java prog
which can take million integers as input,
sort them (bubble or quick or selection sort).
It should display time taken to sort first 10 integer, then for first 100 integer, then for 10000 and total.
Please help me soon I have very less time to complete my project.
iamsohail.srk@gmail.com
|
|
|
|
|
You'll have a greater chance of getting an answer if you post in the JAVA forum[^].
And when you do, be sure to say what you've tried and where you're stuck.
|
|
|
|
|
Sohail Sowell wrote: I want a code of java prog You can get help if you are stuck with a specific question on writing the code; but if you are looking for someone to do your work, this is the wrong place.
Good luck.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Your less time is not a problem for us. We are help to help, not to serve.
In Java integers have a limit. You cannot exceed those limits, otherwise you will face a problem known as "Integer Overflow" or "Integer Underflow". It depends on the size of that type, int or long etc. However, there is another special class in Java, BigInteger[^]. You can use it to overcome these limitations in Java.
Rest of the stuff are just fancy algorithm based functions. If you are well aware of these functions and algorithms then you can definitely write them yourself. What is so difficult in these problems? Learn more on them, https://en.wikipedia.org/wiki/Bubble_sort[^], https://en.wikipedia.org/wiki/Selection_sort[^], https://en.wikipedia.org/wiki/Quicksort[^].
Then use timer to check how long does it take to complete the task. Simple!
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
Afzaal Ahmad Zeeshan wrote: Learn more
I think this may be an invalid assumption
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I want a code of java prog
which can take million integers as input,
sort them (bubble or quick or selection sort).
It should display time taken to sort first 10 integer, then for first 100 integer, then for 10000 and total.
Please help me soon I have very less time to complete my project.
iamsohail.srk@gmail.com
|
|
|
|
|
No, this is not how it works. We gladly help when you get stuck but we aren't going to do all your work for you.
You didn't even manage to post this in the correct forum.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
I am using sql server 2005.
I have a column with date values (say column1). I need to fetch the date which does not exist in the past 15 days.
Means : user insert records daily. But on May 1st due to leave no records got inserted. So I need to analyse past 15 days (from current date) and fetch only May 1st.
I tried below query.But its return the past 15 days (excluding weekends). But i need days which not exist in past 15 days.
select distinct top 15 inserteddate from table1 where
((DATEPART(dw, inserteddate) + @@DATEFIRST) % 7) NOT IN (0, 1) and ( inserteddate >= DATEADD(DAY,-15,inserteddate) and inserteddate <= getdate())
order by inserteddate desc
Help me pls.
modified 11-May-15 9:22am.
|
|
|
|
|
I would suggest you create a temporary table with the dates for the last 15 days and then select the dates from the temporary table not in the table1 you referenced.
The temporary table can be populated using a while loop.
|
|
|
|
|
Realized you might need to go across month boundaries, so yes, I think generating a list dates 15 days back in a table variable and doing a datediff against those in a join might be the easiest solution.
|
|
|
|
|
Something like this should work:
WITH cteTally (N) As
(
SELECT TOP 21
ROW_NUMBER() OVER (ORDER BY (SELECT NULL)) - 1
FROM
sys.objects
),
cteDays (TheDate) As
(
SELECT
DATEADD(day, -N, GetUtcDate())
FROM
cteTally
)
SELECT
TheDate
FROM
cteDays As D
WHERE
((DATEPART(dw, TheDate) + @@DATEFIRST) % 7) Not In (0, 1)
And
Not Exists
(
SELECT 1
FROM table1 As T
WHERE T.inserteddate = D.TheDate
)
ORDER BY
TheDate DESC
;
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Is there any benefit to the CTE over a temp table. I consider the temp table to be much more readable but if there was a significant performance benefit I will need to reconsider!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
For 21 rows, there probably won't be much difference in performance between a CTE and a temp table.
I prefer the CTE solution because it's a single statement. With a temp table, you need to check if the table exists, create it, populate it, run your query, and drop it again.
Of course, if you've already got a tally table in your DB, then you could use that instead. It might even be worth creating a table of dates, so that you can mark holidays and other closures as well as weekends.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
For simple dates I have a view that goes from start of previous year to + 10 years but for some apps I have a table Holiday with all the public holidays of various countries we deal with.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
how to display employee name, department name and salary where department number 10 ?
|
|
|
|
|
Display it where? On the screen, a form, the console, printer ... ?
|
|
|
|
|
SELECT employeename, departmentname, salary FROM employees WHERE departmentno = 10;
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Can somebody tell me why the following isn't working?
UPDATE JobTicket_024 SET JobTicket_024.file = Replace([file_link],"\\52qjkl-as-004p","F:\CE\CE\CEDrawings");
I stole this from a previous update I did to the same table.
Now I'm just changing the path again.
It updates the field "file" with "\\qjkl-as-004p" not the new path. What gives?
Thanks in advance.
Windows 7
MS Office 10 (32 bit)
Access
64bit machine
modified 7-May-15 10:06am.
|
|
|
|
|
You are asking sql to look at the file_link column, find "\52qjkl-as-004p" and replace it with "F:\CE\CE\CEDrawings" and put the result into the file column.
Perhaps a before and after picture would help.
However, instead of UPDATE just change to SELECT so you can see what it will do.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|