|
Hi,
what you oculd also try is something like this...
SELECT top(20)* FROM _yourtable
WHERE _tableID not in (select top(20) tableID from _yourtable)
|
|
|
|
|
Hi friends,
Is any tutorial or useful link for stored procedure optimization with example.
I searched in google.But it is not enough. Please if you know send me,
Hope your's reply.
Thanks & Regards
Every Successful Person Have A Painful Story
|
|
|
|
|
|
Hi mik
Thanks for yours reply.
Every Successful Person Have A Painful Story
|
|
|
|
|
I have been listening so many different answer to question of favorite database. I would like to know what is favorite database of SQLAuthority.com readers. I encourage all of you to participate in this poll. It is very quick poll and takes a second.
A gift of USB drive will be provided to user who will also add comment discussing this subject matter. I encourage to send emails to your friends to participate in poll. I am hopping this poll becomes landmark poll for people who are finding answer to favorite database.
http://blog.sqlauthority.com/2009/02/25/the-poll-what-is-your-favorite-database/[^]
Kind Regards,
Pinal Dave
|
|
|
|
|
pinaldave wrote: I would like to know what is favorite database of SQLAuthority.com readers. I encourage all of you to participate in this poll.
Since I don't read SQLAuthotity.com, I only heard of it just a moment ago, if I participated then it would skew your results. It would no longer be a poll of favourite databases of SQLAuthority.com readers.
|
|
|
|
|
Hi,
It is not for my readers only.I would like to collect data from every developer in world.
Please participate in poll.
Kind Regards,
Pinal
|
|
|
|
|
pinaldave wrote: I would like to collect data from every developer in world
Good luck with that. Most marketing companies have the view that if they get a response from 1% of the audience they are doing exceptionally well.
Heck! Many elections can struggle to get 50% turn out.
|
|
|
|
|
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)[^]
|
|
|
|