Grabbing data from a database with SQL | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Grabbing data from a database with SQL

Is it possible to extract certain information from a table from a database using Query Analyzer. Where can i find information on doing this. Thanks
Yes of course. I think your best starting point would be Books Online, it’s the documentation that comes with SQL Server when you install it.
"How do you expect to beat me when I am forever?"
You will want to focus on learning the SELECT statement.
——————
Brad M. McGehee
Webmaster
SQL-Server-Performance.Com
If you are not the DBA, then I would get with him and make sure you have proper permissions to extract the information you require and that he knows that you are doing it.<br /><br /><img src=’/community/emoticons/emotion-1.gif’ alt=’:)‘ /><br /><br />———-<br />T Kelley<br />MS, MCDBA, OCA, CIW<br /><br />
i am a newbie when it comes to sql language. What i need to have done is i need to extract certain fields from a table, under a certain condition (when certain field is = to some number) from a user database. I am reading up on this select command but i have no idea on where to look. can someone help me out
You need to probably look on the web and understand some of the general principles behind databases. I did a quick search for SQL on google, and came up with this site<a target="_blank" href=http://www.w3schools.com/sql/default.asp>http://www.w3schools.com/sql/default.asp</a> I HAVE NOT checked it out, just quickly glanced at it and it might be a good starting point. My favorite SQL Server website is www.sqlteam.com and this one (of course [<img src=’/community/emoticons/emotion-1.gif’ alt=’:)‘ />]).<br /><br />Good Luck<br /><br /><br />"How do you expect to beat me when I am forever?"
The SQL Server Books Online is generally installed on your SQL Server. If you don’t have direct access to it, you can download it at:http://www.microsoft.com/sql/techinfo/productdoc/2000/books.asp. In fact, this version is more updated than the version that comes with SQL Server, and I highly recommend that everyone download, if they haven’t already.
——————
Brad M. McGehee
Webmaster
SQL-Server-Performance.Com
This is the script i came up with but how do i export the information to an ascii file. SELECT t_type,t_odoc,t_leac,t_amnt,t_dbcr,t_fprd,t_fyer,t_cuno,t_user,t_date
FROM ttfgld106100
WHERE t_leac=’11009′
You can use bcp for this in correlation with xp_cmdshell. All document in books online.
"How do you expect to beat me when I am forever?"
Also you can do the same using ISQL or OSQL utility, which is reliable way. As all referred its better to refer to books online for more information on the tips. Satya SKJ

Using the DTS export function is also an easy and quick way to export data. Of course, if you are new to SQL Server, all these suggestions might be a little overwhelming. You will just need to take your time and learn as you go. What you want to do is relatively straight forward and well explained in the documentation.
——————
Brad M. McGehee
Webmaster
SQL-Server-Performance.Com
]]>