Suggest Me A Simple And Good Tutorial For T-SQL
Nov 17, 2006Hi,
Can someone suggest me a simple and nice tutorial that can explain T-SQL with examples.
Plizzz....
Regards..,
Aazad
Hi,
Can someone suggest me a simple and nice tutorial that can explain T-SQL with examples.
Plizzz....
Regards..,
Aazad
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 **
View 1 Replies View RelatedDoes anyone know of a good matrix tutorial which shows a finished report and how the choices for Page, Columns, Rows, and Details map to a finished report? Having a tough time wrapping my head around the direct impact, and for whatever reason, my sample data keeps triggering an "Out of memory" during preview mode.
View 2 Replies View RelatedHi There
View 13 Replies View RelatedDoes anyone know any good MS SQL or TSQL tutorials? I know the basics of SQL, such as joins, functions such as COUNT, SUM etc so I do not need one of them. Problem is I am using MS SQL at a new role in work and finding it difficult. I write the statements how I would in oracle of mysql but find that they refuse to work, and I can not find/use the MS SQL Help to find what I want.
Cheers, Mike
Hi AllI know that I should supply the DDL for the tables I'm going to talk about,but I'm not 100% on how to generate them just yet. Hopefully my question ismore a query methodology question than how the tables are constructed.My first attempt at the query is as follows:SELECT st.STOCKID, sd.FULLDESCRIPTION, sc.NAME, Sum(sq.QUANTITYINSTOCK) AS'Qty In Stock Total', Sum(st.QUANTITY) AS 'Qty Sold'FROM STOCK s, STOCKCATEGORIES sc, STOCKDESCRIPTIONS sd, STOCKQUANTITIES sq,STOCKTRANSACTIONS stWHERE sc.STOCKCATEGORYID = s.STOCKCATEGORYID AND st.STOCKID = s.STOCKID ANDsd.STOCKID = s.STOCKIDAND sq.STOCKID = s.STOCKID AND (sd.LANGUAGEID='UK') AND(st.TRANSACTIONTYPE=8) AND(sq.QUANTITYINSTOCK > 0)GROUP BY st.STOCKID, sd.FULLDESCRIPTION, sc.NAMEThis works in a fashion, but I need to sort of query the stocktransactionstable again to get the sum of the st.QUANTITY table for st.TRANSACTIONTYPE=1so that I can have an extra select field of Sum(st.QUANTITY) AS 'QtyOrdered', ie transactions with transactiontype of 1 are sales orders andtype 8 are invoices.I basically need to get a report result of:PRODUCT, DESCRIPTION, CATEGORY, CURRENT_STOCK_QTY, SALES_IN_PERIOD,ORDERS_IN_PERIODIs there any pointers whatsoever you can give me to try and get thisdouble-double query to work?Many thanks.Rgds Laphan
View 3 Replies View RelatedBefore page 12, step by step instructions work!
Then there is code for AllProducts.aspx that doesn't work if one inserts the code
into the DataTutorial project started on page 1. Yes I changed the name of the CodeFile!
The code given for AllProducts.aspx.cs doesn't compile.
I was doing better without the tutorial!
I can gleen out some concepts but that is all.
If that is all, why have a tutorial?
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.
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.
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.
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... :)
View 5 Replies View RelatedHi,
I have a table with two columns like this.
teacher table
teacher_id
1
2
3
4
5
6
student table
student_id --teacher_id
1 ----------- 10
1 ----------- 11
2 ----------- 12
2 ----------- 13
2 ----------- 14
3 ----------- 15
4 ----------- 16
Now i need the least assigned teacher_id's in the teachers table. i.e i need teacher_id's 5,6.
One possible way of writing the query is given below.
DECLARE @teachers TABLE
(
teacher_idint
)
INSERT INTO @teachers
SELECT1 UNION ALL
SELECT2 UNION ALL
SELECT3 UNION ALL
SELECT4 UNION ALL
SELECT5 UNION ALL
SELECT6
DECLARE @students TABLE
(
teacher_idint,
student_idint
)
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....
Thanks in advance
Suresh
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.
2. What code page do I need so this will load?
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
View 3 Replies View RelatedHello,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.
View 2 Replies View RelatedHi,
I need you to suggest me one book so that I can learn T-sql - beginner to advanced.
I want to start writing queries like Manivannan and others so that i can also help others
Please suggest and give me a plan. I am ready to sincerely dedicate 2-3 hours every day.
thanks
Hi all,
What are the factors to be considered while desiging a cube..
creating cube through wizard is the way to do it ?
How to determine abt fact and dimension tables..
pls provide me more links to get more idea about Cubes .. which helps me a lot to furthur proceed.
Thanks,
Nav
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.
View 1 Replies View RelatedHi,
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?
Thank you.
Victor
See topic
View 1 Replies View RelatedHI there... i'm really new to this, and i want to know if there is a tutorial of how to connect to sql database, display the data online, and run some queries....
thanks in advance
please e-mail me to hachemr@hotmail.com
Where can I find a good MDX tutorial ..
I am a beginner with analysis services
but got a job in which i have to create a cube and some mdx querires
Try this outRegards,Josephhttp://db2examples.googlepages.com
View 1 Replies View RelatedDo you know a good link (i.e. on msdn) that has a good tutorial for SSIS?
Thanks
Hey guys, while going thru the sql tutorial #5 on this website, I have run into an error. Am using, sql server management studio where it is required I attach a database, on adding the selected db, here is the error that I get, and i have no clue whatsoever on how I must proceed:
TITLE: Microsoft SQL Server Management Studio------------------------------
Attach database failed for Server 'parijat'. (Microsoft.SqlServer.Smo)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.3042.00&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Attach+database+Server&LinkId=20476
------------------------------ADDITIONAL INFORMATION:
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
------------------------------
Could not find row in sysindexes for database ID 7, object ID 1, index ID 1. Run DBCC CHECKTABLE on sysindexes.Could not open new database 'MyCompany'. CREATE DATABASE is aborted. (Microsoft SQL Server, Error: 602)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=602&LinkId=20476
------------------------------BUTTONS:
OK------------------------------
hi there! im new to MSSQL and i want to know if anyone of you knows a reliable website which teaches a detailed and in depth info on how to use mssql...
thanks!
I'm using VB to access MDBs, and now I want to expand my work to a SQL server. Does anyone know where someone of my needs can find a suitable tutorial?
Thanks in advence,
Chen
There's a tutorial (http://msdn2.microsoft.com/ms345296.aspx) on how you create a login in SQL Server. But when I type a new user name I get the error message that the name allready exists. But if I type a existing user name I get the error message that the user name or group couldn't be found.
View 3 Replies View RelatedHi all,
i'm looking for an article on how to use DataTypes of SQLServer in T-Sql script writing !!!?
As you know the Books-Online has limited example and i have trouble undertanding for example how to use Binary,varbinary Decimal,Float,real...in T-sql script
Could anyone showm me an instructive article on the net?
Thanks in advance.
I'm a coldfusion programmer that works with SQL Server databases. We have the opportunity to move our database from a shared sql server to a semi-private virtual machine with our own copy of sql server 2005. We'll all of a sudden be able to use more features of sql server including replication. We want to be able to keep several databases on the same server in sync so that we can have a production database and a development database that are identical.
I'm not a professional dba but I am willing to learn. Is there a good, straightforward tutorial about setting up and using replication out there that someone can recommend?
Many thanks!
Are there any good free online tutorials for T-SQL?
View 2 Replies View RelatedHi Forum-Members,
I was doing the Step by step tutorial "Developing a SQL Mobile Application with Visual Studio 2005 and SQL Server 2005". Link: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnppcgen/html/med302_msdn_sql_mobile.asp
Doing it on Windows XP (as required by the tutorial) worked fine for me, doing it on a Windows Server 2003 installation failed, as the client could not connect to the SQL Server database.
Does anyone have experience stepping through the tutorial on a Windows Server 2003 machine?
Best Regards,
Tobias