Good MS SQL Syntax Reference

May 23, 2007

Hey everyone,

I am looking for a good MS SQL syntax reference, preferably by Microsoft. It would be nice if it were in the same format as MySQLs documentation.

View 1 Replies


ADVERTISEMENT

Anyone Know Of A Good T-Sql Reference Code Book?

Nov 6, 2003

Hi does anyone know of a good book that has all the t-sql keywords and functions in?? Or a webiste that has a printable version with explanations. I knows its on msdn but its very hard to print it all off.

I need something by my side so I can refer too and use in helping me build statements and sp,s etc.

Thanks

View 3 Replies View Related

Good Reference Locations For Information

Aug 6, 1998

Just as an aside...

If you have a question or problem with SQL Server you might want to try three places before/in addition to listing questions here... only because it will be quicker for you rather than waiting for someone to post a response.

1) SQL Server Books OnLine (install on hard disk when you install SQL Server... full set of manuals and highly indexed)
2) http://www.microsoft.com/Support/ (you may need to register but it is free) (Use Support OnLine and look under SQL Server for specific support)
3) http://support.microsoft.com/support/default-faq.asp (FAQ)

Both can help with error numbers and #2 is especially good to find known bugs, fixes, work arounds, etc.

Hope this helps,

Don

View 1 Replies View Related

SQL 2012 :: DTSX Giving Errors - Object Reference Not Set To Instance Reference

Sep 10, 2014

I am using vs 2010 to write my dtsx import scripts.I use a script component as a source to create a flat file destination file.Everything have been working fine,but then my development machine crashed and we have to install everything again.Now when i use the execute package utility to test my scripts i get the following error:

Error system.NullReferenceException: Object refrence not set to an instance reference.

In PreExecute section
TextReader = new system.io.streamreader(" file name")
In the CreateNewOutputRows:
dim nextLine as string
nextLine = textReader.ReadLine

[code]...

is there something which i did not install or what can be the error?

View 0 Replies View Related

Incorrect Syntax Near The Keyword CONVERT When The Syntax Is Correct - Why?

May 20, 2008

Why does the following call to a stored procedure get me this error:


Msg 156, Level 15, State 1, Line 1

Incorrect syntax near the keyword 'CONVERT'.




Code Snippet

EXECUTE OpenInvoiceItemSP_RAM CONVERT(DATETIME,'01-01-2008'), CONVERT(DATETIME,'04/30/2008') , 1,'81350'




The stored procedure accepts two datetime parameters, followed by an INT and a varchar(10) in that order.

I can't find anything wrong in the syntax for CONVERT or any nearby items.


Help me please. Thank you.

View 7 Replies View Related

Incorrect Syntax When There Appears To Be No Syntax Errors.

Dec 14, 2003

I keep receiving the following error whenever I try and call this function to update my database.

The code was working before, all I added was an extra field to update.

Exception Details: System.Data.SqlClient.SqlException: Incorrect syntax near the keyword 'WHERE'


Public Sub MasterList_Update(sender As Object, e As DataListCommandEventArgs)

Dim strProjectName, txtProjectDescription, intProjectID, strProjectState as String
Dim intEstDuration, dtmCreationDate, strCreatedBy, strProjectLead, dtmEstCompletionDate as String

strProjectName = CType(e.Item.FindControl("txtProjectName"), TextBox).Text
txtProjectDescription = CType(e.Item.FindControl("txtProjDesc"), TextBox).Text
strProjectState = CType(e.Item.FindControl("txtStatus"), TextBox).Text
intEstDuration = CType(e.Item.FindControl("txtDuration"), TextBox).Text
dtmCreationDate = CType(e.Item.FindControl("txtCreation"),TextBox).Text
strCreatedBy = CType(e.Item.FindControl("txtCreatedBy"),TextBox).Text
strProjectLead = CType(e.Item.FindControl("txtLead"),TextBox).Text
dtmEstCompletionDate = CType(e.Item.FindControl("txtComDate"),TextBox).Text
intProjectID = CType(e.Item.FindControl("lblProjectID"), Label).Text

Dim strSQL As String
strSQL = "Update tblProject " _
& "Set strProjectName = @strProjectName, " _
& "txtProjectDescription = @txtProjectDescription, " _
& "strProjectState = @strProjectState, " _
& "intEstDuration = @intEstDuration, " _
& "dtmCreationDate = @dtmCreationDate, " _
& "strCreatedBy = @strCreatedBy, " _
& "strProjectLead = @strProjectLead, " _
& "dtmEstCompletionDate = @dtmEstCompletionDate, " _
& "WHERE intProjectID = @intProjectID"

Dim myConnection As New SqlConnection(System.Configuration.ConfigurationSettings.AppSettings("connectionstring"))
Dim cmdSQL As New SqlCommand(strSQL, myConnection)

cmdSQL.Parameters.Add(new SqlParameter("@strProjectName", SqlDbType.NVarChar, 40))
cmdSQL.Parameters("@strProjectName").Value = strProjectName
cmdSQL.Parameters.Add(new SqlParameter("@txtProjectDescription", SqlDbType.NVarChar, 30))
cmdSQL.Parameters("@txtProjectDescription").Value = txtProjectDescription
cmdSQL.Parameters.Add(new SqlParameter("@strProjectState", SqlDbType.NVarChar, 30))
cmdSQL.Parameters("@strProjectState").Value = strProjectState
cmdSQL.Parameters.Add(new SqlParameter("@intEstDuration", SqlDbType.NVarChar, 60))
cmdSQL.Parameters("@intEstDuration").Value = intEstDuration
cmdSQL.Parameters.Add(new SqlParameter("@dtmCreationDate", SqlDbType.NVarChar, 15))
cmdSQL.Parameters("@dtmCreationDate").Value = dtmCreationDate
cmdSQL.Parameters.Add(new SqlParameter("@strCreatedBy", SqlDbType.NVarChar, 10))
cmdSQL.Parameters("@strCreatedBy").Value = strCreatedBy
cmdSQL.Parameters.Add(new SqlParameter("@strProjectLead", SqlDbType.NVarChar, 15))
cmdSQL.Parameters("@strProjectLead").Value = strProjectLead
cmdSQL.Parameters.Add(new SqlParameter("@dtmEstCompletionDate", SqlDbType.NVarChar, 24))
cmdSQL.Parameters("@dtmEstCompletionDate").Value = dtmEstCompletionDate
cmdSQL.Parameters.Add(new SqlParameter("@intProjectID", SqlDbType.NChar, 5))
cmdSQL.Parameters("@intProjectID").Value = intProjectID

myConnection.Open()
cmdSQL.ExecuteNonQuery
myConnection.Close()

MasterList.EditItemIndex = -1
BindMasterList()


End Sub

Thankyou in advance.

View 3 Replies View Related

Which Is Faster? Conditional Within JOIN Syntax Or WHERE Syntax?

Mar 31, 2008

Forgive the noob question, but i'm still learning SQL everyday and was wondering which of the following is faster? I'm just gonna post parts of the SELECT statement that i've made changes to:

INNER JOIN Facilities f ON e.Facility = f.FacilityID AND f.Name = @FacilityName

OR

WHERE f.Name = @FacilityName


My question is whether or not the query runs faster if i put the condition within the JOIN line as opposed to putting in the WHERE line? Both ways seems to return the same results but the time difference between methods is staggering? Putting the condition within the JOIN line makes the query run about 3 times faster?

Again, forgive my lack of understanding, but could someone agree or disagree and give me the cliff-notes version of why or why not?

Thanks!

View 4 Replies View Related

Converting Rrom Access Syntax To Sql Syntax

Sep 23, 2007


Ok I am tying to convert access syntax to Sql syntax to put it in a stored procedure or view..
Here is the part that I need to convert:

SELECT [2007_hours].proj_name, [2007_hours].task_name, [2007_hours].Employee,
IIf(Mid([task_name],1,3)='PTO','PTO_Holiday',
IIf(Mid([task_name],1,7)='Holiday','PTO_Holiday',
IIf(Mid([proj_name],1,9) In ('9900-2831','9900-2788'),'II Internal',
IIf(Mid([proj_name],1,9)='9900-2787','Sales',
IIf(Mid([proj_name],1,9)='9910-2799','Sales',
IIf(Mid([proj_name],1,9)='9920-2791','Sales',

)
)
)
)
) AS timeType, Sum([2007_hours].Hours) AS SumOfHours
from................

how can you convert it to sql syntax

I need to have a nested If statment which I can't do in sql (in sql I have to have select and from Together for example ( I can't do this in sql):
select ID, FName, LName
if(SUBSTRING(FirstName, 1, 4)= 'Mike')
Begin
Replace(FirstNam,'Mike','MikeTest')
if(SUBSTRING(LastName, 1, 4)= 'Kong')
Begin
Replace(LastNam,'Kong,'KongTest')
if(SUBSTRING(Address, 1, 4)= '1245')
Begin
.........
End
End

end




Case Statement might be the solution but i could not do it.






Your input will be appreciated

Thank you

View 5 Replies View Related

Good SQL Book

May 30, 2007

hello
 i am just starting to learn sql and know the basics, but now im looking for a good book to learn some more. A book that covers stored procedure would be very useful. If possible a book with q and a would be very good because i feel this tests if u understand what was just explaned. but if there is a good book without this it is ok. All sugestions welcome
 
NubNub

View 1 Replies View Related

What Is Good Approch

Aug 7, 2007

hii am using vs2005 for development of web application for reporting with sqlexpress05  as back end .later when project is ready for deployment i have to deploy the project on remote hosting server where i have limited access and sqlserver2000 database to use.i want to ask is there are any limitation or problem of sqlexpress while deploying it on remote sqlservre 2000.and should i have to to continue with sqlexpress as back end.is there any problems for using dynamic database connections(by using smart tags) other than programaticaly connecting database to asp.net ie by writing code.i am new in developmentplease guide me, please guide   

View 2 Replies View Related

Good Searching

Jan 7, 2008

 hello all..i have make a searching, but is not good. my code like that:Public Class getall Public Function getitem(ByVal id As String) As DataSet        Dim con As SqlConnection = New SqlConnection("Data Source=BOYsqlexpress;Initial Catalog=GAMES;User ID=ha;Password=a")        Dim ds As New DataSet()          Dim adapter As New SqlDataAdapter("select * from [item] where name like '%" & id & "%'", con)        Try            con.Open()            adapter.Fill(ds, "user")            Return ds        Catch ex As Exception            Console.Write(ex.Message)        Finally            con.Close()            con = Nothing        End Try        ' Next        Return ds    End Functionand class  my item in database is containning  dragon ball 3, counter strikeif i insert dragon, it can display dragon ball 3.but if i insert dragon 3, it not display dragon ball 3.it should display dragon ball 3 .how should i change my code?thx... 

View 1 Replies View Related

WHERE (@ColName=...) - Not Good?!..

Dec 12, 2003

Hi, gurus!
Of course, you know that this:

... WHERE (COLUMNNAME = @PARAMETER)

works perfectly, but the opposite - when I need to pass
a column name as a parameter - the SQL Server 2000 cursing me...

I was designing some stored procedures and here is what I need:

... WHERE (@COLUMNNAME = 1)

^^^ I need to use a different column names here, so I decided to use
a parameter, but it does not even budge. Of course, I can use workaround:

IF @COLUMNNAME = 'External' THEN
BEGIN
SELECT ... WHERE (External = 1)
END

But, I SO! do not want to do it 9 times - I have 9 column names
to check...

Maybe, there is another way to do it?..

Thanks,
Cheers!

View 3 Replies View Related

I've Never Been Good With Relationships

Feb 15, 2004

I'm having some trouble working out how to query some data. Rather than explain up front, here's some examples of what I want to achieve:

*******************************************************

I've got a structure which looks vaguely like this:

[ANCESTORS]

Grandparent
Parent
Child

If limit by grandparents, then I only get the lineage for that particular grandparent. I.e.:


SELECT *
FROM [ANCESTORS]
( some sort of joins here )
Where Grandparent.Name = 'Cybill'



This would return all of the children of 'Cybill' and their children. Now, if I use the following query:


SELECT *
FROM [ANCESTORS]
( some sort of joins here )
Where Child.Name = 'Jean'



This would return Jean's parents + the parents of Jean's parents (Jean's grandparents).

Likewise, if I enter:


SELECT *
FROM [ANCESTORS]
( some sort of joins here )
Where Parent.Name = 'Ron'



Then I would get Ron's parents and also his children.


*******************************************************

So, as you can see, at first it appears that I'm after a LEFT JOIN - meaning that the grandparents don't need to have child records to be returned, but, then it turns out that I need INNER JOINS - to limit grandparents when I choose children.

Can anybody see my dilemma here?

Mark-up ASP.net posts here
MarkItUp.com

View 10 Replies View Related

MCDBA Is Good For DBA?

Jan 21, 2001

Hi All

I am planning to do MCDBA, whether it'd good for DBA's, is't worth of doing or not, Please send me your comments.

Thanks

Regards
Ram

View 5 Replies View Related

Good Book For Using DTS?

Aug 23, 2000

I have been using DTS somewhat, but I would like to read a good discussion (with cpmplex examples) of it.

Anyone found either a book on DTS or a good section in a book?

Thanks,
Judith

View 1 Replies View Related

Any Good DTS Books

Sep 30, 2002

Does anyone know of any good books on DTS? I am currently using SQL 7.

Thanks in advance

View 2 Replies View Related

Any Good Books

Sep 14, 1998

Hi there,

Any good books to Know the internals of MS-SQL server 6.5

Thanks
Vivek

View 2 Replies View Related

What's A Good SQL Editor?

Oct 28, 2004

Hi everyone

I'm wondering if there's a better SQL Editor than MS Query Analyzer on the market? I like a lot of the functionality provided by QA but want extra stuff like you get in VB6: intelli-sense (sytanx prompting), auto-complete (CTRL+Space provides list of sp's and tables, etc.) plus any other time saving features.

I've tried a few products but nothing quite hits the mark. Is there a program you use and recommend I trial?


Cheers - Andy

View 14 Replies View Related

Good SQL Query

Mar 7, 2005

Folks, i've got a table with a column; ACCOUNT VARCHAR(30). All the values numeric though. (leave abt the datatype yet).
The column is clustered indexed.

SELECT * FROM MYTABLE WHERE LEFT(ACCOUNT,3)='123'
execution plan shows CLUSTERED INDEX SCAN.

SELECT * FROM MYTABLE WHERE ACCOUNT LIKE '123%'
execution plan shows CLUSTERED INDEX SEEK.

How, why. Why doesn't the optimizer works good for the first query?


Howdy!

View 7 Replies View Related

If Your Good With SQL Queries - Please Help

Apr 9, 2008

Hi, ive got some work to do on SQL queries, the scenario is below and at the bottom is my attempt at answering in the questions:
Could somebody simply tell me if the answer at the bottow are correct, if not what I have done wrong.

A local company that produces machine parts has decided to develop an in-house database system. They have identified the following tables: -

tblOrders OrderNo, CustomerNo, Date, OrderTotal

tblCustomers CustomerNo, Name, Street, Town, County, Postcode

tblParts PartNo, Description, UnitCost

tblItems OrderNo, PartNo, Quantity, ItemTotal



Create SQL queries to produce the following: -

a) Details of all orders over £1000 sorted by customer
number.

b) A list of all part descriptions and their quantities appearing on order 39

c) Delete all orders placed by customers in
Wrexham.

d) Archive all orders placed by customer Clarke into a new table called
tblArchive.

e) Increase the price of all parts whose description includes the
word “washer” by 4%.

These are my answer, which im not too sure if they are correct. If any1 could tell me if there correct or not that would be great, thanks.

a)
SELECT *
FROM tblOrders
ORDERBY CustomerNO
WHERE OrderTotal > 1000

b)
SELECT tblParts.PartNo, tblParts.Description, tblItems.Quantity
FROM tblItems INNER JOIN tblParts ON tblItems.PartNo = tblParts.PartNo;
WHERE OrderNo = 39

c)
DELETE tblOrders.*
FROM tblOrders INNER JOIN tblCustomers ON tblOrders.CustomerID = tblCustomers.CustomerID
WHERE Town = “Wrexham”

d)
INSERT INTO tblArchive
SELECT *
FROM tblOrders INNER JOIN tblCustomers ON tblOrders.CustomerID = tblCustomers.CustomerID
WHERE Name = “Clarke”

e)
UPDATE tblParts
SET UnitCost = [UnitCost]*1.04
WHERE Description LIKE “*washer” or Description LIKE “washer*” or
Description LIKE “*washer*”


Please help :)

View 1 Replies View Related

MS SQL Server Is Good With ...?

Feb 13, 2004

Hi,

I'm about 6 weeks into SQL and SQL Server (7) - I was wondering whether you could share your opinions about which language to use as a programming tool for developing apps for & with SQL Server. I'm choosing between C++ (Visual) or JAVA.

I already know C and the DB-Libe contains a lot of it but I'm kinda trying to expand some horizons. I'm ok with either C++/VC++ or JAVA but I only have time to learn (or be good at) one.

Any suggestions? (I'd like to hear what you think even if you say neither C++ or JAVA - maybe VB? What's easy and marketable is what matters most.)

Thanks.

View 1 Replies View Related

Need A Good Book...

Apr 27, 2004

I've been a SQL Server dba for 5 or 6 years now. With the upcoming release (eventually, I'm sure) of Yukon/SQL2005, I've read that it's important for DBA's to pick up one of the .NET languages - I've figured, I'll try to learn VB.NET - I've had a little exposure to it, and can usually figure out what's going on in VB code I've read - however, I seriously doubt I could write anything in it from scratch - I want to learn it in a bad way - can you all recommend any self-paced books that will walk me thru it? I've never had any formal training with it, don't know a class from a DLL....Thanks in advance for your help!!

View 3 Replies View Related

Need Good Idea

Jul 23, 2005

Hi guysWe have a following problem. For security reasons in each table in ourDB we have addition field which is calculated as hash value of allcolumns in particular row.Every time when some field in particular row is changed we create andcall select query from our application to obtain all fields for thisrow and then re-calculate and update the hash value again.Obviously such approach is very ineffective, the alternative is tocreate trigger on update event and then execute stored procedure whichwill re-calculate and update the hash value. The problem with thisapproach is that end user could then change the date in the tables andthen run this store procedure to adjust hash value.We are looking for some solution that could speed up the hash valueupdating without allowing authorized user to do itThanks in advance,Leon

View 6 Replies View Related

Good SQL Book?

Jul 20, 2005

hello, for a new job i might have to learn SQL. i've neverworked with databases or SQL, so i'll need to learn. cananybody advice me on what would be a good book to learnfrom? i'm quite an experienced programmer, so it doesn'thave to be a dummies guide, and preferably not a bulky booklike the "SQL bible" or something.oh, one of my 'favourite' computer books of all times is"thinking in Java" by bruce eckel, to give you an idea.mike--not sure if there's a better group to ask these questions

View 4 Replies View Related

I'd Like To Get A Good Book Of SQL...

Apr 20, 2006

Would all of you give me a suggestion of valuable book in terms of SQL ??

I confused what kind of SQL book is going to be good for me to study since

I begin to jump into MS-SQL...

Furthermore, I'd know that various level of book as begginer, intermediate , advance...

Thanks for your help in advance..

View 6 Replies View Related

Which Version Of SQL Is Good For Me?

Mar 11, 2008

Hi all,
I have couple of databases in access which i want to spilit them in backend and frontend, and then put the backend( just tables) in sql and keep frontend in access.
which version of sql is good for me to do that?
by the way there are more than 10 users want to access the front end for dataentry.
all the databases and the sql server can be in the same server.

thanks in advance,
Azi

View 6 Replies View Related

Web Developer Looking For Good SQL Book

Jan 6, 2007

I'm looking to buy a book about SQL, T-SQL, stored procedures, etc. I'm a web developer, so I don't need a book for a SQL Server administrator. I need a book that tells me what I as a developer need to know about SQL. I'm currently using Visual Studio, SQL Server 2005, ASP.NET 2.0, and VB.NET (and fairly new to all of those) if that makes any difference. The bulk of my web developing experience has been with PHP and MySQL so this is new territory for me. I hope all that makes sense. I would appreciate any suggestions for such a book.
Thanks!
-Mathminded
p.s. I bought a bunch of Wrox books and haven't had them long enough to decide if I like them: "Professional ASP.NET 2.0", "Professional ASP.NET 2.0 Security, Membership, and Role Management", "ASP.NET 2.0 Website Programming", and "Visual Basic 2005". I thought I'd check with the experts before investing in another book. :-)

View 2 Replies View Related

A Good SSIS Book?

Jan 7, 2007

I am new to SQL2005 and have been given the task of writing some SSIS packages to import some CSV files.
I need to cleans the data as it is imported from my CSV files before it reaches my SQL DB.
I am currently Googling the internet to discover how to do this.
Can anyone recommend  a good SSIS book?
I am a C# developer, so a book that has lots of SSIS C# examples would be good.
Any help appreciated.
Regards,
Paul.
 

View 3 Replies View Related

A Good Way To Increment Field Value

Nov 15, 2007

 HiI have a field containing numbers. I want to do some simple arithmetics with it, say value=value+1 or value=value-1 or or even value+2. What is to be done, is fixed at design time. I think this could be done by loading the row or record to my program and doing the calculations there. And then storing the record back. But this seems too complicated.Is there a single query doing that in data table. 

View 3 Replies View Related

For What Are Good Relationships Between Tables?

Jan 25, 2008

hello,
i am wondering, for what i use relations between tables? if i make sure that the data inserted into the table matches, for what i need table relationships?
i have a table named Pictures with: PictureID, UserID, UserName, PictureName, Description...
do i have to make relationships between UserID from Pictures and UserId from aspnet_Users?
and the second table PicturesComments witch has: CommentID, PictureID, UserID, UserName...
do i have to makre relationship between PictureID from PictureComments and PictureID from Pictures AND between UserID from Pictures and UserId from aspnet_Users?
sorry for this stupid questions...
thanks

View 5 Replies View Related

Can Anyone Explain To Me Why This Is Not A Good Idea

Jan 28, 2008

I have a complex select statement that is used in several stored procedures. I decided that instead of having x number of T-SQL scripts with the same exact select statement that I would to put this query into a view and then do a select * from View.  Recently an instructor told me that this was a bad idea and that anyone who uses a select * from anything should be fired.  When I asked for his reasoning his response was to say the least abnoxious.  I can understand why a Select * from Table might be a bad idea as the table definition can change, but the chances of a view changing seems much less likely.
Is a view a good idea in this case?  Is the Select * from View really a bad idea?
 Thanks
 
 

View 6 Replies View Related

I Need A Very Good SQL Genious To Help Me Figure Out How To Do This....

Sep 15, 2005

I have a simple table right now that has some rows listed like this:Table Name = TicketStatusTicketNumber      TicketType        Status         Time1                             Normal               In                 09/15/2005 10:50:213                             Normal               In                 09/11/2005 19:25:101                             Normal               Out              09/15/2005 11:45:103                             Normal               Out              09/11/2005 20:27:092                             Normal               In                 09/14/2005 17:25:101                             Normal               Pay              09/15/2005 11:15:152                             Normal               Out              09/14/2005 21:45:30What I want to do is select only 1 row per ticket number, and this row needs to be the row that has the LATEST time for that particular ticket number.  Then I want to sort the results by ticket number decending.  So for instance, the select I am looking for would bring me back ONLY the following rows in the following order: TicketNumber      TicketType        Status         Time3                             Normal               Out              09/11/2005 20:27:092                             Normal               Out              09/14/2005 21:45:301                             Normal               Out              09/15/2005 11:45:10My issue is I do not know how to go about selecting ONLY 1 row per ticket number, and the row I select has to be the row with the latest date for that particular ticket number.Can any SQL gurus provide me with some code in order to do this?  Thanks so much for the help guys!

View 1 Replies View Related

Need A Good Book On Replication????

Jul 31, 2000

Anyone has a suggestion on a good book on Replication. How to set it up.. I am looking for a good detailed book on this subject.

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved