April 13, 2012 at 2:50 pm
GilaMonster (4/13/2012)
capn.hector (4/13/2012)
Duplicate post all replies here http://www.sqlservercentral.com/Forums/Topic1282601-392-1.aspx
oooooooooooooooooooooooooooooooooooooooooooooooooohhhhhhhhhhhhhhh
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
April 16, 2012 at 8:12 am
The only kind of function you can insert rows into in SQL Server is a single-table inline-table-value-function.
Those are defined like:
create function dbo.MyFunction (@Param datatype)
returns table
as
return (select columns from dbo.MyTable where tests);
A function like that can be the target of any normal DML statement, including inserts, deletes and updates.
No other type of function can.
Therefor, you cannot do what you are trying to do. SQL Server doesn't work that way.
I recommend either taking a class on the subject, or at least reading a basic book on it. If neither of those is a viable option, get your employer to hire a DBA or a contractor to do this sort of work instead of forcing you to do something you don't know about.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
April 16, 2012 at 8:31 am
Sean Lange (4/13/2012)
Here is how all of the threads that you have started sound.There were two crocodiles flying. One to the south but another one was blue.
Question: How many seats in our local theater?
The Right Answer: I don't need a fridge as I do not smoke.
That is mine one! Until you are Russian of my age as well 😀
Actually the right question should be:
How many seats in our local CINEMA?
April 16, 2012 at 8:41 am
fine,i will ask them,they r not understanding as they dont know sql.
one thing can solve my prob.
how to calculate cumulative of any field.
if you know let me know
April 16, 2012 at 8:44 am
hbtkp (4/16/2012)
fine,i will ask them,they r not understanding as they dont know sql.one thing can solve my prob.
how to calculate cumulative of any field.
if you know let me know
Not sure how many times we have told you thins, but I'm sure it would take more than all of our fingers and toes.
Unless you take the time to post all the information we need to understand your problem (which if you took the 15 minutes it would take to read the first article I reference in my signature block, just click on it) we can't help you. We are not in your office with the capability of seeing what you are doing and trying to accomplish.
April 16, 2012 at 8:52 am
hbtkp (4/16/2012)
one thing can solve my prob.how to calculate cumulative of any field.
if you know let me know
The SUM function perhaps? Just guessing here, it's not clear (again) what you're asking.
Look it up in Books Online.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
April 16, 2012 at 8:58 am
Eugene Elutin (4/16/2012)
Sean Lange (4/13/2012)
Here is how all of the threads that you have started sound.There were two crocodiles flying. One to the south but another one was blue.
Question: How many seats in our local theater?
The Right Answer: I don't need a fridge as I do not smoke.
That is mine one! Until you are Russian of my age as well 😀
Actually the right question should be:
How many seats in our local CINEMA?
I was hoping that whoever I got this from would come forward. I will correct the verbiage to cinema and make sure I give you credit (now that I know who is belongs to). That is one the funniest things about a question/answer I have ever read. 😀
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
April 16, 2012 at 9:02 am
MAY BE U CAN understand by this
NUMBER CUMULATIVE
0.00
2.78 2.78
1.01 3.82
2.07 5.97
1.71 7.78
2.21 10.16
0.23 10.41
0.69 11.17
-0.01 11.16
-1.70 9.27
5.51 15.29
-2.47 12.44
-4.28 7.63
2.97 10.82
-2.50 8.06
2.38 10.62
FINAL CUMULATIVE 10.62
its not sum
April 16, 2012 at 9:05 am
hbtkp (4/16/2012)
MAY BE U CAN understand by thisNUMBER CUMULATIVE
0.00
2.78 2.78
1.01 3.82
2.07 5.97
1.71 7.78
2.21 10.16
0.23 10.41
0.69 11.17
-0.01 11.16
-1.70 9.27
5.51 15.29
-2.47 12.44
-4.28 7.63
2.97 10.82
-2.50 8.06
2.38 10.62
FINAL CUMULATIVE 10.62
its not sum
WOW...just wow. You are the most stubborn person I have ever met about providing information to the people who are trying to help you.
Solving the Running Total and Ordinal Rank Problems (Rewritten)[/url]
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
April 16, 2012 at 9:05 am
hbtkp (4/16/2012)
MAY BE U CAN understand by thisNUMBER CUMULATIVE
0.00
2.78 2.78
1.01 3.82
2.07 5.97
1.71 7.78
2.21 10.16
0.23 10.41
0.69 11.17
-0.01 11.16
-1.70 9.27
5.51 15.29
-2.47 12.44
-4.28 7.63
2.97 10.82
-2.50 8.06
2.38 10.62
FINAL CUMULATIVE 10.62
its not sum
That is called a running total. Still don't have the information needed to help you. You know, DDL for the table(s), sample data to load into the tables, expected results based on the sample data, and the code you have written in an effort to solve your own problem.
And by the way, your math is off.
April 16, 2012 at 9:24 am
it snot running total,if you see it carefully,
its not just adding values. sometimes its adding 1 ,sometimes it minus 1
April 16, 2012 at 9:28 am
hbtkp (4/16/2012)
it snot running total,if you see it carefully,its not just adding values. sometimes its adding 1 ,sometimes it minus 1
Really, then show us how the calculation is being made. You aren't giving us the information we need to help you. Do you really not understand that? we can't see what you are doing, we can't read your mind. If you really want help from us, you have to help us first. Help us understand your problem. Give us the information we keep asking from you so that we can help you.
April 16, 2012 at 9:48 am
agai my req has change
now i need to calculate maximum date and put it into local variable
April 16, 2012 at 9:53 am
Good for you! It is easy now. Here is an answer:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
April 16, 2012 at 9:56 am
hbtkp (4/16/2012)
agai my req has changenow i need to calculate maximum date and put it into local variable
Your requirements may have changed, but ours hasn't. Following the link in the post above and do what it says to do.
Viewing 15 posts - 16 through 30 (of 85 total)
You must be logged in to reply to this topic. Login to reply