|
select Column1,Column2 from MyTable
union
select 9000 as Column1,'whatever' as Column2
--EricDV Sig---------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
|
Hi,
In my report for the columns iam providing sorting feature.In the report header i have one image.
Image disappears when using sortable columns.That image originally appears when opening report, but disappears after sorting columns.
Why this happens.
Please help me.
Thanks in advance
|
|
|
|
|
i want to search for specific row in database:
first: stored procedure
create procedure search
@name varchar (50)
as
select * from members where name = @name
second:C#
-create connection and open it
-create command and set it to stored procedure
-create parameter and pass value i want to search for to that parameter
i want to know the index of that row sotred procedure returned to pass it to :
DataRow dataRow = dataTable.Rows[index]
to fill textboxs of other fields "phone,hire_date,email,..."
textbox.text = dataRow["phone"];
|
|
|
|
|
If your Stored Procedure only returns one result (because the field 'name' is unique) then the index would be 0, which is the first row in the DataSet/DataTable that you filled using the Stored Procedure.
"A democracy is nothing more than mob rule, where fifty-one percent of the people may take away the rights of the other forty-nine." - Thomas Jefferson
"Democracy is two wolves and a lamb voting on what to have for lunch. Liberty is a well-armed lamb contesting the vote." - Benjamin Franklin
Edbert
Sydney, Australia
|
|
|
|
|
hi all
i need to get the difference between 2 dates
so i use datediff function in SQL to get it but it doesn't work
eveery time it get te same output even if i change the dates i don't know where is the problem
select datediff(year,12/2/2000,getdate())
and the output is 106
tank
abdelhameed81
|
|
|
|
|
abdelhameed81 wrote: select datediff(year,12/2/2000,getdate())
Try putting the date inside apostrophes. Also, it is generally advisable to use the ISO format (yyyy-mm-dd) so that internationalisation problems don't arise.
e.g.
datediff(year, '2000-02-12', getdate())
|
|
|
|
|
Just to further explain what happend. SQL Server interpreted 12/2/2000 as 12 divided by 2 divided by 2000 which is 0.003. Since the the calendar in SQL Server starts on 1st Janurary 1900 you had actually requested the difference in years between 04:19:20 on 1st January 1900 and midnight on 12th February 2006 (or 2nd December 2006 if you use the American format) which is 106.
|
|
|
|
|
Hi
I want to find out the no of rows returned by a select statement in a stored procedure within the stored procedure
ie i have a select statement say
select * from employees where deptid=2
now for the no of rows returned i want to perform a calculation for each row in the stored procedure itself
how can i loop in it and get the no of rows and the records for each row to handle all these in the stored procedure rather than in the front end
Waiting for reply
Happy coding
Subhash
Subhash Chatterji
|
|
|
|
|
SQL cursor[^] to the rescue!
"A democracy is nothing more than mob rule, where fifty-one percent of the people may take away the rights of the other forty-nine." - Thomas Jefferson
"Democracy is two wolves and a lamb voting on what to have for lunch. Liberty is a well-armed lamb contesting the vote." - Benjamin Franklin
Edbert
Sydney, Australia
|
|
|
|
|
|
Hi All,
If we have a table in database which has one of the columns as XMl, we can use that XML record.value('/fieldname[1]','varchar(10)') to get the actual value of the fieldname from that XML record.
But what if we don't know the exaxt name of the field whose value has to be fetched, but we are sure that the pattern we give in will only fetch us one record, then is there a way to specify a pattern matching stuff like a normal like statement using '%Something', which would give us all records ending in "Something".
How do i do this.
Pls guide me
Omkar
|
|
|
|
|
Hi,
I have the following tables:
Item (ItemID) and Item_Keyword(ItemID, KeywordID).
ItemID is a primary key in the Item table.
In the Item_Keyword table, both ItemID and KeywordID are foreign keys.
I need to select such ItemID, that has ALL specified keywords.
Thanks in advance for any idea/help
Sincerely,
Elina
Life is great!!!
Enjoy every moment of it!
|
|
|
|
|
There might be a better way, but this will work:
specified keywords='C++','C#','ASP'
the where clause of the outer query will need to have the TotalWords = the number of specified keywords (3 in this case).
select itemid from (select count(*) as TotalWords, itemid
from item_keyword ik inner join keyword k on ik.keywordid = k.keywordid
where k.keyword in(<code>'C++','C#','ASP'</code>)
group by itemid) as tbl
<code>where TotalWords = 3</code>
--EricDV Sig---------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
Thanks, I cam up with the similar solution.
My concern is, that if there are 3 keywords, say 'Java','C#','ASP' ,
this query will still select it, or wouldn't it?
Sincerely,
Elina
Life is great!!!
Enjoy every moment of it!
|
|
|
|
|
Elina Blank wrote: My concern is, that if there are 3 keywords, say 'Java','C#','ASP',
this query will still select it, or wouldn't it?
I don't understand the question. Please clarify.
--EricDV Sig---------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
Sorry, you are absolutely right!
It works, thanks a lot!
Sincerely,
Elina
Life is great!!!
Enjoy every moment of it!
|
|
|
|
|
I have created a win service which executes a long latency SQL Server stored procedure. The service sits on a different server than SQL Server. If the win service server unexpectedly crashed right after I have called the stored procedure, would the stored procedure continue its execution or fail because the connection was lost?
|
|
|
|
|
I'm trying to run the following ODBC command. It's returning 0 when I'm expecting a positive integer. Can anyone see where I'm going wrong?
ok=DBC (PREPARE, db_conn, "SELECT c.QuestionID FROM (SELECT DISTINCT QuestionID FROM Questions WHERE TopicID = ?) AS c LEFT OUTER JOIN (SELECT DISTINCT QuestionID, UserID FROM UserResponses WHERE UserID = ?) AS d ON c.QuestionID = d.QuestionID WHERE d.UserID <> ? OR d.UserID IS NULL ORDER BY c.QuestionID": db_stmt)
I am (fairly) confident that the SQL is correct as it is performing as expected when tested in Visual Web Developer.
Thanks,
Alice
|
|
|
|
|
In my ASP.NET.net site ,I sometimes(but not always) get this error :
Timeout expired.The timeout period elapsed prior to completion of the operation or the server is not responding.
I think its sql server error . Someone tell me how I can solve this problem.
I need urgent help .
|
|
|
|
|
There are a number of options:
1. Increase the timeout. See SqlCommand.CommandTimeout
2. Check the hardware configuration of your SQL Server can handle the loads you are applying to it.
3. Check your code for performance bottlenecks.
|
|
|
|
|
In two of my pages I have 6 roundtrips to sql server.In the other 3.Lets say in the worst case average of 3 roundtrips per page.All queries are simple queries that return records with few fields.and number of records are not more than 30.
Can problem be from my side ???? Is it that hard ?
|
|
|
|
|
devboycpp wrote: In two of my pages I have 6 roundtrips to sql server.In the other 3.Lets say in the worst case average of 3 roundtrips per page.All queries are simple queries that return records with few fields.and number of records are not more than 30.
Can problem be from my side ???? Is it that hard ?
First you need to identify the query that is throwing the timeout exception. Once you've identified the query, you can see if it is possible to optimize the query. If not, you can try setting the SqlCommand CommandTimeout[^] to a longer number of seconds.
|
|
|
|
|
Hi,
I am new to Crystal Report. I am having a problem with crystal reporting. When ever I try to connect the Report with Related data by Dataset, no data appears on Report.
But without related data it shows records on Report.
I am trying to follow the tutorials and Database expert to Generate my report
does any body have any clue?
|
|
|
|
|
The insurance Software is to be developed for a group that is acting as an intermediary for the provision of car rental worldwide.
insurance is a tool used by customer or general public to avail the facility of online car rental service. The system is also used by the executives of call Centre setup by the client to provide services to offline customers. The system shall also assist various agents in the travel industry to provide services to their customers.
Desktop application will be a powerful window based application. It will be implemented using VC# front end and SQL Server back end.
o Functionalities
· It should provide interface to Manage Suppliers, Product, Price, Vehicle, Customers, Agents, and Whitelabeller etc.
· It should be able to Manage Users their roles and permissions.
· It should provide an interface for bookings
· It should integrate with Payment application ( Servebase) for payment authorizations.
· It should be able to generate various reports for Admin, Management and Finance.
o Users : It can be used by
§ Call Centre at Central Office
§ Call Centre at regional office
There are two main components of the business the internet and the inhouse call Centre reservation system.
· Booking Engine : this can be used to make online booking
· Agent Interface : this can be used by registered agent to make bookings and to view their details.
· Admin Interface : this can be used by Admin members of the company to view some of the reports.
|
|
|
|