|
sishya wrote: Can anyone tell me the advantages of functions over stored procedures and vice versa and i am not shoor if i can use system ftions like getdate() in functions
pls help me out
You cannot use functions such as GETDATE() because they are non-deterministic. A function must have a deterministic operation. i.e. Given the same inputs it will always produce the same output.
I wouldn't go around and convert stored procedures to functions just because.
I wouldn't say functions or stored procedures have any avantages over each other. They are designed for different uses.
A function can return data to calling code more easily that a stored procedure can. A stored procedure can perform data modification actions (INSERT/UPDATE/DELETE) that a function can't.
Scottish Developers events:
* .NET debugging, tracing and instrumentation by Duncan Edwards Jones and Code Coverage in .NET by Craig Murphy
* Developer Day Scotland: are you interested in speaking or attending?
My: Website | Blog
|
|
|
|
|
I'm writing a small C# windows application that will create a new database and populate it with tables, views and stored procedures. Of course I am using SQL scripts that I'm launching from the windows application. I ask the user to enter 2 fields, the server name and the instance name of the SQL server.
My question is: is there a way to check if the entered server name and instance exist?
Since I launch the scripts by starting a process to run osql, I don't know if I get some return value to tell me that the server was not found. So basically even if the server name is wrong, the application says that the operation is completed, although nothing has been done.
Thanks,
Talal
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning."
--Rich Cook
|
|
|
|
|
|
Thanks, I'll try that out
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning."
--Rich Cook
|
|
|
|
|
Hi All,
I have setup of my vb application running on a computer with backend sqlserver2000 on same computer. I want that I can run my application on many computers which are networked with the same central database. Can any one please suggest me what parameters should I have to keep in my mind or simply how can I achieve this?
I will be very thankful.
Varun Arora,
Software Engineer,
Knowledge Calls,
Gurgaon, India
|
|
|
|
|
|
It might be a silly question
I want to retrieve the data when some action is performed
Actually,when the page is loaded default data loads in to the data grid
when the combo box Item is selected then I want to retreive the data related to that particular condition
Do i need to create one more data adapter and data set
If not How can i do that
can any one of u guys tell me
Thanks
|
|
|
|
|
Store all the information in one dataset. When the combo box is created you can select out of this existing dataset based in conditions given - maybe selecting only one type of products codes based on selected value.
|
|
|
|
|
Hi,
I have a table like this:
Param Cat Pay
---- ---- ---------
bugj home rent
bugj home repair
budj home something1
budj car something2
budj car somethg3
budj tax somethg4
My progam has to search the field cat and list all the categories. i.e home,car,tax
Plese can you tell me if there is any particular sql which eliminates repititions?
Thanks
Fortitudine Vinsinues!
|
|
|
|
|
SELECT DISTINCT Cat FROM TableName
----------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
Thank you.
Fortitudine Vinsinues!
|
|
|
|
|
Hello All,
I have a table that has 4 coloums of which one is primary key and is set to auto increment.
Is it possible to write a stored procedure that inserts value in the rest of the three coloumns and returns the value of the primary key that was generated automatically.
|
|
|
|
|
I'm not a database expert, but nobody else answered your question so I'll give it a shot. It sounds like you're using Oracle or something because you said auto increment instead of index. But, in SQL Server, you can write an insert statement in your stored procedure like this:
insert into [table]
(
column1,
column2,
column3
)
values
(
@column1,
@column2,
@column3,
)
return SCOPE_IDENTITY()
That will return the value in the identity column.
In Oracle, you do it two ways. The first way is to have a sequence and get the next value of the sequence first using:
SELECT table_seq.NEXTVAL AS ID from DUAL
Then when you do your insert, use that ID in your insert.
The other way is to have a sequence and a trigger. Do your insert and then select the max value for that column out of the table and return it. The first way is probably better.
Any of you db gurus out there, please correct me if I'm wrong.
Logifusion[^]
|
|
|
|
|
Thanks Dustin, that was fast. I am actually using SQL Server 2000 and I am sorry I forgot to mention.
|
|
|
|
|
with SQL server its the same but you do
:
RETURN @@IDENTITY
Jon
|
|
|
|
|
Hi,
What happens when we try to update a data in a dataset which is already deleted in sql server?
Thanks in advance
|
|
|
|
|
i want to check column of type image in my database to see if image column in the selected row has image in it or it null?
ma_refay
|
|
|
|
|
|
Hello all,
using SQL server 2000 does anyone know a sql statment to get a list of trigger names that are associated with a table?
|
|
|
|
|
just to clarify im looking for a way to list the defiend triggers of a particular table.. I have found examples for oracle and MySQL5.0 but nothing for SQL Server 200.
Oracle = select trigger_name from user_triggers;
MySQL = SELECT TRIGGER_NAME,ACTION_TIMING FROM INFORMATION_SCHEMA.TRIGGERS WHERE EVENT_OBJECT_TABLE='TEST_TABLE';
|
|
|
|
|
ahh dont worry...
ive found it.. it: exec sp_helptrigger table_name
|
|
|
|
|
ahh.... actually im still having trouble.. while that works im still unable to use that select statement programatically... Does anyone know how i can do this?
|
|
|
|
|
ahh dont worry... ive cracked it!!!
select name as 'Trigger', object_name(parent_obj) as 'Table' from sysobjects where xtype = 'TR' and object_name(parent_obj) = 'MY_TABLE_NAME'
where 'MY_TABLE_NAME' is the name of the table
|
|
|
|
|
hi, i want to find the solution for the following sql query..
there is a table T(x,y,z)
i want to insert 10 records into table T using a sql query.
sam
|
|
|
|
|
Nigam Samir wrote: i want to insert 10 records into table T using a sql query.
You can use loops for this purpose either in Stored procedures or in front end application.
_____________________________
Success is not something to wait for, its something to work for.
|
|
|
|