Jump to content

SqlBeginner

Members
  • Posts

    35
  • Joined

  • Last visited

About SqlBeginner

  • Birthday 10/18/1988

Profile Information

  • Gender
    Male

SqlBeginner's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. I have a form that features a drop down list that uses sqldatasource1 to automatically have the user selected. I'm wanting to add linkbuttons (A-Z) so when the user selects the given linkbutton only users who's last name begins with that letter is visible in the drop down list. I have stored procedure written and created sqldatasource2 for this but I'm unsure of how to code it to reflect what I'm wanting it to do.
  2. CREATE PROCEDURE
  3. I have been looking over stored procedures for quite some time now and can't seem to find an example of what I'm wanting to do. I'm wanting to pull certain fields from database A to be inserted into database B and update accordingly. I was first attempting to write one procedure but then was looking at writing a stored procedure in A and then calling the procedure in B and then inserting there...
  4. DELIMITER //CREATE PROCEDURE GetOfficeByCountry(IN countryName VARCHAR(255))BEGINSELECT city, phoneFROM officesWHERE country = countryName;END //DELIMITER ; Will you explain delimiter and the reason for the information in ()
  5. OK so there is a trigger on the table that add/updates information and I would need to write the stored procedure to have that information updated to the second table?
  6. I am wanting to write a procedure that will insert new/updated fields into another table Ex: tblStaff and tblUsers Fields in tblUsers needs to be inserted into tblStaff when new records or added or fields are updated. What is the best route to go to accomplish this?
  7. I am working on a test server with this right now. I wanted to make sure that by dropping the table it wouldn't be negatively effecting anything when it was time to transfer the information to the live side.
  8. ultimately I have two tables. I'm needing to insert information from one table into the other but I get the error about the fields I'm needing to insert to being too small. (issue from previous post) I was just going to change the data type in the empty table and then do my insert but I got the error message. So that's why I was looking to drop and recreate. The table I was going to drop is ultimately empty so I thought that'd be the best one to drop and recreate.
  9. When I try to change the data type I get the error "Saving changes is not permitted. The changes you have made require the following tables to be dropped and re-created. I get the error for both tables.
  10. I am needing to change the data type in a table but it won't allow me to. I usually manually drop and recreate a table but was going to try and use SQL server template since the table is rather large (right click on table-> script table as-> drop and create to) Would you suggest using this template or just manually writing it myself and going from there? IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[tblStaff]') AND type in (N'U'))DROP TABLE [dbo].[tblStaff]GOUSE [Test]GO/****** Object: Table [dbo].[tblStaff] Script Date: 07/10/2013 12:39:35 ******/SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOCREATE TABLE [dbo].[tblStaff]( [StaffID] [bigint] NOT NULL, [LastName] [varchar](50) NULL, [FirstName] [varchar](50) NULL, [Status] [nvarchar](10) NULL, [FileNum] [int] NULL, [Supervisor] [nvarchar](150) NULL, [extension] [nvarchar](25) NULL, [JobID] [varchar](10) NOT NULL, [StartDate] [datetime] NULL, [EndDate] [datetime] NULL, [Note] [nvarchar](250) NULL, [Other] [nvarchar](150) NULL, [AddedBy] [nvarchar](50) NULL, [DateRecDeleted] [datetime] NULL, [DeletedBy] [nvarchar](50) NULL, [SSMA_TimeStamp] [timestamp] NOT NULL, [MachineName] [nvarchar](50) NULL) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]GO
  11. OK thank you! That's exactly what I was trying to figure out!
  12. Yes I was trying to get help as far as varchar and nvarchar so I could pinpoint which fields were to small. One table used nvarchar and the other used varchar so I was trying to see what the conversion for them would be if that makes sense. example of data types that are trying to go into other data types are: bigint ->int varchar(50)->nvarchar(50)
  13. Insert into dbo.tblStaff (StaffID, FirstName, LastName, JobID, StartDate, Email, SS)SELECT [UserID] ,[FirstName] ,[LastName] ,[JobCode] ,[StartDate] ,[EmailAddress] ,[Keyword] FROM [ACU].[dbo].[Users] WHERE [WebActive]='1' and [EndDate] IS NULL and [LoginName] like 'ABCDE%'
  14. I am wanting to insert fields from a table (data types are varchar(50) into another empty table (who's data type is nvarchar(50)). I believe I have created the correct query to achieve this but received an error message when executing "Msg 8152, Level 16, State 4, Line 1 String or binary data would be truncated" Would these two data types be the cause of this? I'm using some other data types (int, bigint) that could possibly be the issue but these are the main ones used to I wanted to see about them first.
×
×
  • Create New...