|
Hi friend,
I have a doubt. Could you clear my doubt?
Actually what is raising events available in stored procedure?
If it is yes, how can we implement and test?
Is any useful link or tutorial available for raising events in sp?
Hope yours reply.
Thanks & Regards
Every Successful Person Have A Painful Story
|
|
|
|
|
Programming in T-SQL isn't event based so you cannot use events like you would in Visual Studio. However, yuo can use for example Queues[^].
|
|
|
|
|
In stored procedure we use sp_sendmail and send sms, other notification are all events?What about that.
Every Successful Person Have A Painful Story
|
|
|
|
|
Guvera wrote: In stored procedure we use sp_sendmail and send sms, other notification are all events?What about that
There are several ways of notifying info from the database: mail, sms, queues, file writes, alerts etc. but none of these are events as they're defined for example in C#.
Since you haven't provided any more info about what you actually want to do, it's hard to say what would be a good choice in your situation.
|
|
|
|
|
how to identify tokens in a sql statement
|
|
|
|
|
I believe that the previous answer also covers this: see[^].
|
|
|
|
|
how to get name of the file before extention from database..
|
|
|
|
|
Do you mean a database file or just a string that contains a filename.
To remove the path and the extension, you could try something like:
declare @filename varchar(50);
set @filename = 'c:\a\b\c\filename.extension';
set @filename = substring( @filename, 1, charindex( '.', @filename) - 1)
while charindex( '\', @filename) > 0
begin
set @filename = substring( @filename, charindex( '\', @filename) + 1, 999999)
end
select @filename
And if you're interested in files of a database you should have a look at sys.database_files[^]
|
|
|
|
|
hi,
Which system table in the MS sql hold the information about the user created tables?
regards,
Bill
|
|
|
|
|
Hi,
It depends on what information you're looking for and what version of SQL Server you're using. If you're using 2005 or higher, you could use:
select * from sys.tables
|
|
|
|
|
Hi
I developing a Emplyee Scheduler I need to display weekly Schedule of every Employee in a Single row but I am get records in columns (verticly)
just need to display them like Whole week record in fornt of name of employee. I am using ASP.NET and C# .... can any help its urgent
|
|
|
|
|
Without knowing anything more of your query (or about the data) it's quite impossible to say what's the problem. You could have a look at Using PIVOT and UNPIVOT[^]. Perhaps it is what you're looking for.
|
|
|
|
|
thanx but i am using SQL 2000,let me make u littel bit clear i am getting records like
name1 - date1 - Schedule
name2 - date2 - Schedule
name1 - date1 - Schedule
name2 - date2 - Schedule
and I want or display
------- - date1 - date2
name1 - Schedule - Schedule
name2 - Schedule - Schedule
I hope you and understand and help me
modified on Thursday, February 26, 2009 2:21 PM
|
|
|
|
|
Hi,
I am using dataset to update/insert the data in the database. Whenever its about to update the dataset, it gives me the following error:
"OleDbCommand.Prepare method requires all parameters to have an explicitly set type."
Can somebody please help me with this problem?
Here is my code:
using (OleDbConnection conn = new OleDbConnection(ConnectionString))
{
try
{
conn.Open();
OleDbCommand selectCmd = new OleDbCommand("select * from tableA where col1=? and col2=?", conn);
selectCmd.Parameters.AddWithValue("@col1", val1);
selectCmd.Parameters.AddWithValue("@col2", val2);
OleDbDataAdapter adapter = new OleDbDataAdapter(selectCmd);
OleDbCommandBuilder builder = new OleDbCommandBuilder(adapter);
DataSet selectDS = new DataSet();
adapter.Fill(selectDS, "TableA");
DataTable table = selectDS.Tables["TableA"];
DataRow row = null;
int mode = 0;
if (table.Rows.Count > 0)
{
row = table.Rows[0];
mode = 1;
}
else
{
row = table.NewRow();
}
row["col1"] = val1;
row["col2"] = val2;
row["col3"] = val3;
if (mode == 0)
{
table.Rows.Add(row);
}
adapter.Update(selectDS, "TableA");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
conn.Close();
}
}
Thank you,
Prateek
|
|
|
|
|
Explicitly and fully define each parameter. Personally, I think it is poor practice to allow a DB to infer such information when it is known ahead of time. It is fairly simple and will reflect well on the continued maintenance of your system. And as a bonus it will eliminate errors such as this from your code.
|
|
|
|
|
Thanks, I'll keep that in mind.
|
|
|
|
|
I agree with Ennis that it's a 'bad' practice to let the autogeneration to create the statements. But if you want to use it, there are two conditions you must meet:
- you must use command builder when select statement is created
- there must be a key column present in the dataset
I think it's the later that may be causing problems. Another possible cause may be column names that contain illegal characters or reserved words. So you should check if for example UpådateCommand is generated correctly.
More info: Generating Commands with CommandBuilders (ADO.NET)[^]
|
|
|
|
|
Dear Friend's
I have an application for Finance Management which created using Visual Studio 2005 for frontend using c# language and sql server 2005 as backend, in this system i use float datatype for storing all amount, but now it's giving me lots of calculation error because of roundup and other things, so our team plan to convert datatype float to decimal, is this ok or should we plan something else??
And if the changing datatype decision is ok then can you give me easiest way to change the datatype in one shot for all table from my database....
thanks and regard's
Sasmi
|
|
|
|
|
It really depends on how much precision you need. Oh and if you deal in Indonesian Baht. Also make sure you are not dealing with the Zimbabwe currency, you will run out of zeros very fast.
I work in a finanacial instution and we use decimal 38,6 for all our calcs. We had 38,10 for a while but were getting stray 1 in the 9th decimal position for some reason. Changing to 6 decimal places fixed a lot of issues for us.
Also you cannot convert from e number direct to decimal, you have to go through float first.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
thanks for your reply
Sasmi
|
|
|
|
|
Just as a side point to this, we've used decimal thoughout our database and personally I think its massive overkill. If you are losing precision with a float, then fair enough but high precision decimals take a whopping 17 bytes of space as opposed to your 4 for a float.
In our case, everything fits fine into a float, so the other 13 bytes are just pure overhead. No wonder the database is the size of Belgium.
Regards,
Rob Philpott.
|
|
|
|
|
So,
If you remove the overhead from Belgium, Belgium will float?
Wout Louwers
|
|
|
|
|
Well, that's not quite what I meant, but probably...
Regards,
Rob Philpott.
|
|
|
|
|
Rob Philpott wrote: No wonder the database is the size of Belgium.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
And here I thought I was the only one that cared about database size.
|
|
|
|