Jump to content

SqlBeginner

Members
  • Posts

    35
  • Joined

  • Last visited

Everything posted by SqlBeginner

  1. SqlBeginner

    Databases

    CREATE PROCEDURE StaffInfo (list name of fields with @ sign in front and separated by commas from database *****.dbo.AC_Users) AS SELECT (List name of fields wanted from *****.dbo.AC_Users) FROM *****.dbo.AC_Users WHERE (list name of fields from second database Train******.dbo.tblstaff that we want corresponding fields inserted into) GO Is this how it should be set up for both databases?
  2. SqlBeginner

    Databases

    <p>One of my co worker said that I should be able to just write a stored procedure and it communicate between the two servers without linking them. This is an example of one I found that I thought would correlate with multiple parameters </p><pre>CREATE PROCEDURE uspGetAddress @City nvarchar(30) = NULL, @AddressLine1 nvarchar(60) = NULLASSELECT *FROM AdventureWorks.Person.AddressWHERE City = ISNULL(@City,City)AND AddressLine1 LIKE '%' + ISNULL(@AddressLine1 ,AddressLine1) + '%'GO For my actual situation I modified it to this but still unsure of exactly how to write it out. The first database is Databasetblstaff with the fields </pre><pre>[userID], [FirstName], [LastName], [FacilityID], [Department], [JobCode], [supervisorID], [startDate], [EmailAddress], [Keyword], [EmployeeID], [EmployeeType] put into the database Training with correlating fields C[staffID], [FirstName], [LastName], [LocationID], [DeptID], [JobID], [supervisor], [startDate], , [sSN], [FileNum], [EmpType] REATE PROCEDURE StaffInfo @City nvarchar(30) = NULL, @AddressLine1 nvarchar(60) = NULLASSELECT [userID], [FirstName], [LastName], [FacilityID], [Department], [JobCode], [supervisorID], [startDate], [EmailAddress], [Keyword], [EmployeeID], [EmployeeType]FROM Database.dbo.tblstaff WHERE City = ISNULL(@City,City)AND AddressLine1 LIKE '%' + ISNULL(@AddressLine1 ,AddressLine1) + '%'GO</pre>
  3. SqlBeginner

    Databases

    Perfect! Thanks
  4. SqlBeginner

    Databases

    I was attempting an INSERT INTO statement for this but I'm getting the error invalid column names. Is it because I'm referring two different columns in two different tables in two different databases and I need to do something before I'm able to write a statement between the two first? I'm getting the error for the columns for both tables.
  5. SqlBeginner

    Databases

    Would this query keep the tables updated when there are new fields added into the referenced table?
  6. SqlBeginner

    Databases

    Would SELECT INTO statement work for this?
  7. SqlBeginner

    Databases

    This question is in reference to the very first posted question. I have both databases pulled up in SQL Server Management Studio and have identified with tables and fields for both databases I need. I need to bring in 1 table information from database A into a table in database B. I looked at the import wizard but wasn't sure if this was the best route. The amount of data is a couple thousand and I want new information put into table in the specified fields in database A to automatically update in the tables in database B
  8. SqlBeginner

    Databases

    Why would a database only have the tables properties and event_update?
  9. SqlBeginner

    Databases

    They are on different servers. I'm not familiar with "attaching" databases. What situations would you suggest this for?
  10. SqlBeginner

    Databases

    I am a recent grad and have started my career working for an It department. I am on my second project and am having some issues figuring out how to do a task.Our IT department manages many medical facilities. As of right now each facility is tracking their trainings invidually and now my boss (head of IT) wants all facilities to start to have a centralized system in tracking trainings. We purchased train tracks which is a system that pretty much tracks trainings and we have the client server version with web accessability. We ultimately want the HRM database to communicate with the train track database so that it'll automatically put new hires and certain positions into specified trainings. I am a beginner in SQL so my question is what would be the best route to go about getting these two databases to communicate this. I've seen some information about linking and joins but I'm still not 100% sure which would be the best route.
×
×
  • Create New...