December 14, 2010 at 9:19 am
Ok I was just given a task I have no idea what to do...Have a sql database where I need to pull client first and last name plus address that is related to a specific site ( hospital, mall, etc..)
December 14, 2010 at 9:36 am
Hi,
You'll have to give us a bit more information than that sorry.
Is all the data in the same table or is distributed amongst a few tables? Either way, have a read of http://msdn.microsoft.com/en-us/library/ms187731.aspx - it should explain what you need to do.
Thanks,
December 14, 2010 at 1:59 pm
Typically the "pull" is through a query. As far as how you'll get the data to people, you'll have to make some decisions.
If you are just pulling this from a database in SQL Server, you can use a SELECT query to do this.
Basically
SELECT
(columns you need)
FROM (table names)
WHERE (column name = some value)
You can get some basic SQL information here: http://www.sqlservercentral.com/articles/Administration/beginningsqlserverlimityourqueries/1458/
December 14, 2010 at 2:02 pm
Is this supposed to be an export from one database and imported into another database? SSIS works well for that - as does bcp.
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
December 14, 2010 at 2:04 pm
How'd you end up with the task? Are you the DBA, or did you just get suckered with the usual, "you're good with computers, you figure it out", kind of thing?
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
December 14, 2010 at 7:07 pm
Yes got scammed into doing it .....since the other person decide to pursue other work some where else....(Fired)
Yes all the data is in different tables...except client info is located in dbo.clients....however the location is located in I do not know...tried finding like "Bob the builder" location but no luck....Please help....
December 14, 2010 at 7:40 pm
I would start looking at procs that provide similar data. You need to familiarize yourself with the data in your database - look at tables, keys, relationships and data in the tables.
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
December 15, 2010 at 8:44 am
webin (12/14/2010)
Yes got scammed into doing it .....since the other person decide to pursue other work some where else....(Fired)Yes all the data is in different tables...except client info is located in dbo.clients....however the location is located in I do not know...tried finding like "Bob the builder" location but no luck....Please help....
Kind of thought as much.
Are you familiar with writing basic "select" statements?
Here's something that might help you find which table has "locations" in it. Might not, it'll depend on the architecture, but it usually does.
SELECT OBJECT_NAME(object_id) AS , NAME
FROM sys.all_columns
WHERE name LIKE '%address%';
It'll give you a list of all the columns that have "address" in their name, and the tables they belong to. That usually helps finding where address data is stored.
Does that help?
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
December 15, 2010 at 8:59 am
SELECT OBJECT_NAME(object_id) AS , NAME
FROM sys.all_columns
WHERE name LIKE '%address%';
worked pulled information ...However as you can tell new to this...What I am looking at doing is finding client names, address, relate to location salem dialysis....
But I really do like that other script...Thanks FOR YOUR INFO!!!!!
December 15, 2010 at 9:09 am
You can modify that sys.all_columns query to look for different things. Perhaps "name" instead of "address" would allow you to find a table of companies, including their names? That would give you the table to query to get the Salem office you're looking for.
Any luck with that?
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
December 15, 2010 at 9:35 am
If your company has a copy of SQL Toolbelt from Red Gate, I'd run SQLDoc against the database and get a lot of information in a form that might be easier for you to understand.
If not, use the scripts above, and start digging. The easiest way I've found is to take a form from an app, then start using SELECT queries to dig for the data and reproduce the form information. That will help you start to figure out where things are.
December 15, 2010 at 10:03 am
Steve Jones - SSC Editor (12/15/2010)
If your company has a copy of SQL Toolbelt from Red Gate, I'd run SQLDoc against the database and get a lot of information in a form that might be easier for you to understand.If not, use the scripts above, and start digging. The easiest way I've found is to take a form from an app, then start using SELECT queries to dig for the data and reproduce the form information. That will help you start to figure out where things are.
Actually, that's a good idea. You can get a free trial for SQL Doc, http://www.red-gate.com/products/sql-development/sql-doc/, and use that to see if you can figure out where stuff's stored in the database. Definitely worth a shot.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
December 15, 2010 at 10:11 am
I will second that notion. SQLDoc could help you figure things out quite rapidly.
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
Viewing 13 posts - 1 through 13 (of 13 total)
You must be logged in to reply to this topic. Login to reply