Give the suitable answer for the below question and explain the answer.
1.You have designed the database for a Web site (or online ticketing agency) that is used to purchase concert tickets. During a ticket purchase, a buyer view a list of available tickets, decides whether to buy the tickets, and then attempts to purchase the tickets. This list of available tickets is retrieved in a cursor.
For popular concerts, thousands of buyers might attempt to purchase tickets at the same time. Because of the potentially high number of buyers at any one time, you must allow the highest possible level of concurrent access to the data. How should you design the cursor?
(A). Create a cursor within an explicit transaction, and set the transaction isolation level to REPEATABLE READ.
(B). Create a cursor that uses optimistic concurrency and positioned updates. In the cursor, place the positioned UPDATE statements within an explicit transaction.
(C). Create a cursor that uses optimistic concurrency. In the cursor, use UPDATE statements that specify the key value of the row to be updated in the WHERE clause, and place the UPDATE statements within an implicit transaction.
(D). Create a cursor that uses positioned updates. Include the SCROLL_LOCKS argument in the cursor definition to enforce pessimistic concurrency. In the cursor, place the positioned UPDATE statements within an implicit transaction.
Please suggest correct answer (A,B,C,D) for the following Question
You are developing an application for a worldwide furniture wholesaler. You need to create an inventory table on each of the databases located in New York, Chicago, Paris, London, San Francisco, and Tokyo. In order to accommodate a distributed environment, you must ensure that each row entered into the inventory table is unique across all location. How can you create the inventory table?
A.Use the identity function. At first location use IDENTITY(1,4), at second location use IDENTITY(2,4), and so on. B.Use the identity function. At first location use IDENTITY(1,1), at second location use IDENTITY(100000,1), and so on. C.CREATE TABLE inventory ( Id Uniqueidentifier NOT NULL DEFAULT NEWID(), ItemName Varchar(100) NOT NULL, ItemDescription Varchar(255) NULL, Quantity Int NOT NULL, EntryDate Datetime NOT NULL). D.Use TIMESTAMP data type.
hi i am using html checkboxes to let user to select categories in which search has to be done. there are 4 checkboxes for 4 categories. this query i have checked in query anakyzer. this query is working and displaying results.acc to this query user has selected "3 checkboxes" and entered "airports" to search. SELECT * FROM tbl_Arab_Newsletter WHERE (Month(month) = '2' AND year(month) = '2008') and (cat_number = 1 or cat_number = 2 or cat_number = 3) and (story like '%airports%' ) i have written code like this. strSQL = "SELECT * FROM tbl_Arab_Newsletter WHERE (Month(month) = '"& m &"' AND year(month) = '"& y &"')"strSQL = strSQL & " and cat_number = 1" end if if cat2="on" then 'check box 2 is enabled means this conditionstrSQL = strSQL & " and cat_number = 2" end if if cat3="on" then 'check box 3 is enabled means this conditionstrSQL = strSQL & " and cat_number = 3" end if if cat4="on" then 'check box 4 is enabled means this conditionstrSQL = strSQL & " and cat_number = 4" end if strSQL = strSQL & " and (story like '%" & search & "%')" but this statements are not working. how to write the if conditon acc to the query. pls help and if dont mind pls give me the correct code. thank u.
hey can anyone suggest me how to write the efficient( a bit faster) stored proc to generate alternative usernames( with logical variations like the one of hotmail ) if provided one is already present in database... :)
INSERT INTO @students SELECT1 , 10 UNION ALL SELECT1 , 11 UNION ALL SELECT2 , 12 UNION ALL SELECT2 , 13 UNION ALL SELECT2 , 14 UNION ALL SELECT3 , 15 UNION ALL SELECT4 , 16
-- query starts here
SELECT t.teacher_id FROM @teachers t LEFT OUTER JOIN @students s ON t.teacher_id = s.teacher_id GROUP BY t.teacher_id HAVING COUNT(s.teacher_id) = ( SELECT TOP 1 COUNT(s.teacher_id) FROM @teachers t LEFT OUTER JOIN @students s ON t.teacher_id = s.teacher_id GROUP BY t.teacher_id ORDER BY COUNT(s.teacher_id) ) -- query ends here
But the problem with this query is, i am using two outer joins on the same query and on the same tables....
If teacher table and student tables have few thousands of records, this query will not perform good....
Please suggest another way of writing the query which can perform well....
I am new in sqlserver UDF, I am written a UDF but it showing error CREATE FUNCTION udf_DayOfWeek(@dtDate DATETIME) RETURNS VARCHAR(10) AS BEGIN DECLARE @rtDayofWeek VARCHAR(10) SELECT @rtDayofWeek = CASE DATEPART(weekday,@dtDate) WHEN 1 THEN ‘Sunday’ WHEN 2 THEN ‘Monday’ WHEN 3 THEN ‘Tuesday’ WHEN 4 THEN ‘Wednesday’ WHEN 5 THEN ‘Thursday’ WHEN 6 THEN ‘Friday’ WHEN 7 THEN ‘Saturday’ END RETURN (@rtDayofWeek) END GO
Error Incorrect syntax near '‘'. Msg 102, Level 15, State 1, Procedure udf_DayOfWeek, Line 16 Incorrect syntax near 'END'.
Error: 0xC02020A1 at Data Flow Task, Source - mysourcefile [1]: Data conversion failed. The data conversion for column "myBadColumn" returned status value 4 and status text "Text was truncated or one or more characters had no match in the target code page.". Error: 0xC020902A at Data Flow Task, Source - mysourcefile [1]: The "output column "myBadColumn" (157)" failed because truncation occurred, and the truncation row disposition on "output column "myBadColumn" (157)" specifies failure on truncation. A truncation error occurred on the specified object of the specified component.
Two questions: 1. How to tell SSIS not to stop for one bad row. Getting the good rows is more important than one bad row.
hello all Plz can u suggest m how can i find substring like i want to show first 50 characters and i dont want that my last 50th character should end with full word .. word should be complete it may b 53 or 54 th character for example :m using : substring(Remark,0,50) as Remarkand it returns : this is .................................. boobut i want thi is ....................................book.complete sentense plz suggest me how is this be don in SQL query.thax alot
Hello,First of all - sorry for may be stupid question, but as I am not aWin* administrator and my field is *nix, I am a little bit stuck witha problem, presented to me by one of the customers. He has few windowsboxes with some webfile and (most important) - mssql database. And heasks for a backup. I found some company, which offers us IBM's Tivolisoftware, but my opinion is that they want a little bit too much forit and also, from my *nix experiece, I know there should be manyother products, probably cheaper and better. If not - we will usethat Tivoli. So we need to backup mssql data and some filessomewhere. The best would be on some ftp.Can anyone please suggest a good and simple way of making such kind ofbackup?Many thanks,Anton.
First posting to the group. I have received a lot of valuable info from youguys. Now, an OT question:What's a good tape drive to perform unmanned weekly backups for a WindowsXP Pro box running SQL server 2000?--Joel Farris | AIM: FarrisJoel** Their Web. Your Way. http://getfirefox.com **
I am trying to recreate the same functionality Google has in regards tosuggesting words (not names), when you misspell something it comes upwith suggestions.We have a list of words in the database to match against.I've looked at SOUNDEX but it is not close enough, DIFFERENCE is evenworse.The only way I can get SOUNDEX to be more accurate is withSELECT [word]FROM [tbl_word]WHERE ( SOUNDEX( word ) = SOUNDEX( 'test' ) AND LEN( word) = LEN('test' ) )I've been looking at Regular Expression matching which I reckon wouldprovide more accurate matches. Not sure how that will affectperformance, as we could be talking about 20,000 records.Or also been looking at the Double Metaphone algorithm.Is there something else that I am missing, anyone know what to use in asituation like this?Thanks in advance.
our company is looking for a good training for SQL server 2005. Majority of attendies will be .NET developers, but some will be technicians who need backup, replication, maint., etc. training. All are pretty familiar with sql server and have experience with SQL 2000. So, it should not be for beginners. Intermediate and advance topics.
Whom you can suggest? Do you have experience with them?
Unbelieveible! I can not seem to find any source for questions database related that don't include using 2.0 controls just as the come out of the box! HELP!!!! Simple issue (or so it seems) but I can't get an anwer: Example: TextBox.Text has information that I want placed in a table in a sql database. So I build a SQLDataSource control, and the triggers to fire the insert method. I modify the InsertCommand of the SQLDataSource so that it will write my record to the table. Something like... InsertCommand="INSERT INTO MyTable(Description, Status) VALUES ('TextBox.Text', 'Default New Record Status)" Now... the problem is with 'TextBox.Text' . When formated as is. the text string TextBox.Text is inserted into a record in the target table. My problem, the simple one remember, is refering to the text string stored inside of TextBox.Text and have that value stored in the new row under the Description column. I can't believe that no one can help with this simple problem. Once resolved then my page is done... this is ALL that holds it up and I can't find a reference to how to go about it. Thanks,Ken....
Hi, I'm working on both VWDEE and VBEE and, in each, when I try to add a database diagram I get the following error message 'Invalid Class String' (after the 'Do you want to create required objects' prompt). Can someone postulate a reason? If I don't get an answer i'll be pretty much dead in the water Thanks in advance of your help.
"Falling back on cursors because they remind you of datasets will result in poor performance "
Hi, The above quote was from an article which advice to use store procedure and avoid T-sql in the body of a webpage. Anyway, To me, I always use cursor when I want to process one row at a time. Is there an alternative to cursor in MS sql server to have similar results.?
What are his steps in the execution of a query? Where/how does he storage the information while executing a query? What type of Index he uses? and so on ...
If anyone knows a website that contains this type of information about the SQL Server SGBD and could share it i would be most appreciated!
1)Which statement shows the maximum salary paid in each job category of each department?_______ A. select dept_id, job_cat,max(salary) from employees where salary > max(salary); B. select dept_id, job_cat,max(salary) from employees group by dept_id,job_cat; C. select dept_id, job_cat,max(salary) from employees; D. select dept_id, job_cat,max(salary) from employees group by dept_id; E. select dept_id, job_cat,max(salary) from employees group by dept_id,job_cat,salary;
2)description of the students table: sid_id number start_date date end_date date which two function are valid on the start_date column?_________¡£ A. sum(start_date) B. avg(start_date) C. count(start_date) D. avg(start_date,end_date) E. min(start_date) F. maximum(start_date)
I'm trying to write a "GetQuote" procedure with a single @Quantity parameter. The purpose of the query is to sum the total cost (price * quantity) of a given (quantity) given the available "Sale" items. The sale table has the following structure:
[SellOrderID] [uniqueidentifier] DEFAULT (newid()), [OrderDate] [datetime] DEFAULT (getdate()), [UserID] [nvarchar](50) , [SellPrice] [float] , [SellQuantity] [int] , [QuantRemaining] [nchar](10) NULL, **QuantRemaining is the sell quantity remaining after existing partial trades on the Sell Order - intentionally denormalised.
A given quantity may be satisfied by multiple 'Sell Orders' and these should be processed from the lowest price first.
e.g. give the following: SellOrderID QuantRemaining Price A 100 $2.00 B 300 $3.00 C 200 $1.75 D 350 $2.50
GetQuote 400 should return: Sum((200*$1.75)+(100*$2.00)+(100*$2.50))
I am relatively new to the DB game and am having problems creating a SQL statement to do this. If anyone has a solution for this it would be greatly appreciated.
I would really appreciate it if someone could give me the answers or directme to a place that would have the answers to the following 5 questions.1. I need an example of SQL select statement. (table tblSource, fields A,B,Cwhere C<100).. "is this an example that I have in ( )?2. I need to list 3 table joins or is "inner, outer, left" etc actual tablejoins? what are the others for my own knowledge.3. Can you join a table to itself? (how? Alias.)4. What is the diff, between distince and distinct row?5. How would you check a value agains a lookup tableA? (IN) or is "IN" theanswer?I am very sorry for my stupidy but I am trying to learn and my boss for onereason or another gave me a ton of questions I cant answer.Someone please help!
Has anyone encountered this error message [Microsoft][ODBC Driver Managr] Driver does not support this function? This occurs when importing data. The company I work for upgraded to Server 2005 and now what once worked fine now has an error. Any suggestions?
hi all, i want to create such a page contains Questions , Answer(this is text feild entered by user) and Correct answer(that can be seen only by admin). Both questions and correct answers already exist in database. When user click the save button ,the answer will be saved into the database and when user click the submit button ,the email notification will be sent to admin. Which control can i use and any advice for my requirements is appreciated. i'm using visual studio 2003 and sql2000.
Hi, I have a table that has the ff: LastName varchar(50) FirstName varchar(50) PhotoPath varchar(50) Now I want to create a form that can accept the LastName,Firstname and also can upload a picture which in turn the filename of the image will be the value for the PhotoPath field, and eventually displays it using the repeater control. Your Help/Info. is highly appreciated...
For some reason I can't reply from within your message.
Make sure you have the same version of SQLserver and service pack on the SQL Server and the workstation you are trying to set up the package from, this is error due to different versions.
Your comand should look like: dtsrun /~S.... /~U ..... /~P ....
----------------------------------------
Subject: From: Date: DTS problem aruna (aruram@hotmail.com) 3/20/01 2:19:38 PM
Hello
I have created a very simple DTS package to transfer data from one database to another on the same server. I am able to successfully execute the package from DTS. But if i try to schedule the package and run it from SQL agent it fails. The job that is created by the SQL agent appears as follows -
and the error message i get is invalid switch .... DTS command invalid options
I have tried working with the /N and /!Y options and they dont work either. Can someone please tell me why is this problem occurring in the first place.
Nobody helped me on other SQL forums, I hope here people are better. Here is my problem : I'm trying to uninstall replication before to re-install it (2 servers working on Windows NT and SQL 6.5 SP5). On the publisher server, I chose Server/Replication Configuration/Uninstall Publishing, but then, I'm not able to re-install publication, as the 'Install Publishing' option is disabled. I've found somewhere on the web that I had to remove the distribution option from the system, which disables replication, with the sp_ServerOption stored procedure :
sp_ServerOption "myserver", "dist", false
then I've deleted the distribution database, but all this didn't change anything, the 'Install Publishing' option is still disabled. How can I get the option enabled ?
Thanks in advance if you can help me. Sorry for the English, it's not my native language.
I have a view based on few tables okay I have a query that gives me document details of various revisions Now i also get the latest rev of those if i use a MAX() in my Query
And if i filter for a month of 12/2004 If i query for latest it should give Document1 - rev2
Now i need to get a filter with latest as rev2, plus i also need as a indication of actual latest as rev 7 using a query
How do i do that ...
Coz when i use filter for a month and Max then it does not consider rev7 for that filter and skip the record and if i try to filter only as per month .. i get a wrong info as latest rev2 which is not a true info as per database records.
May i possibly get both ... filtered info as per specific month and also a rev info as what is the latest for a spec document.
Just i need to know is that possible .. in SQl using a query
Any more info needed please mail me on neeraj.jariwala@gmail.com