Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. NeilO123

    Passing results to a variable

    markros, you are right. I am in your debt, I should have done a double check of the entire code before posting. Thanks a lot for the lesson not only on what you have show me but also to review the code for what can be the obvious
  2. NeilO123

    Passing results to a variable

    markros, I also try the following code with a different error message: CODE USE RUMS GO UPDATE dbo.tbl_hits SET ButtonText = substring(AppName,1, LEN(AppName)-8) , appName='DCR Tool' FROM dbo.tbl_hits WHERE (appName LIKE 'DCR%') Results Msg 207, Level 16, State 1, Line 0 Invalid...
  3. NeilO123

    Passing results to a variable

    Ok,markros, I did try it as follows: CODE USE RUMS GO --App DCR Tool (CHAR 8)-4 DECLARE @varlen int SELECT @varlen = len(appName) from dbo.tbl_hits @varLen=(@varLen-8) UPDATE dbo.tbl_hits SET ButtonText = substring(AppName,1, LEN(AppName)-8) , appName='DCR Tool' FROM dbo.tbl_hits WHERE...
  4. NeilO123

    Passing results to a variable

    markros thanks but, I need to extract the contents off the the column "appName" which contains a variable length string as long as (70 CHAR) and then take the results of the LEN and do a SET to the column "buttonText" for the string that is in the column "appName" less 8 characters, afterwards...
  5. NeilO123

    Passing results to a variable

    Thank you all, based on what hmckillop show me I have created the following code that is closer to what I am trying to accomplish; CODE -- USE RUMS GO --App DCR Tool (CHAR 8)-4 DECLARE @varlen int SELECT @varlen = len(appName) from dbo.tbl_hits @varLen=(@varLen-8) UPDATE dbo.tbl_hits set...
  6. NeilO123

    Passing results to a variable

    Thanks pwise and the same to you markros, but I still have a need to pass the results from a column to a variable, in that way I could manipulate the final out come such as: @varLen=(column1 string length) SET Colum2 = LEFT(column1,(@varLen -[a number]) --- I know this is feasible inside of...
  7. NeilO123

    Passing results to a variable

    Thanks pwise, I do not get an error but I DO NOT get a listing of all the columns only what appears to be the grand total of all rows: Results -- (No column name) 1 117910 -- Expect results (No column name) 1 7 2 9 etc -- I need to list and use the results from on each individual rows. Any...
  8. NeilO123

    Passing results to a variable

    I get a different message, see below -- Msg 512, Level 16, State 1, Line 2 Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression. (1 row(s) affected) -- It should had displayed 19,972
  9. NeilO123

    Passing results to a variable

    I try the new code see below but I am still getting the same results: -- USE AdventureWorks; GO DECLARE @EmpIDVar int; SET @EmpIDVar = (SELECT LEN(FirstName)FROM Person.Contact) SELECT @varLen --FROM Person.Contact GO Results: Msg 137, Level 15, State 2, Line 3 Must declare the scalar variable...
  10. NeilO123

    Passing results to a variable

    Thanks markros, I should add that I am using SQL Server 2005 here it is: -- USE AdventureWorks; GO DECLARE @EmpIDVar int; SET @EmpIDVar = LEN(FirstName) SELECT @varLen FROM Person.Contact GO Results: Msg 137, Level 15, State 2, Line 3 Must declare the scalar variable "@varLen". -- I have try...
  11. NeilO123

    Passing results to a variable

    Thanks but I am still getting an error I did add ";" after "int" but "Msg 102, Level 15, State1, Line 2 Incorrect syntax near @varLen
  12. NeilO123

    Passing results to a variable

    Help to a begginer I am trying to pass the results of a SELECT LEN to a variable and then display the results of the variable, but I must have the code wrong as an example: USE AdventureWorks; GO DECLARE @varLen int SET @varlen = SELECT LEN(FirstName) SELECT @varLen FROM Person.Contact GO Any...
  13. NeilO123

    Can a store procedure be written in c#

    Thanks markros. The book looks like it has what I am looking for.
  14. NeilO123

    Can a store procedure be written in c#

    To those that wonder why I can not use T-SQL, is because I have column with 70 Charcters that needs to be parse into other columns with diffent type of delimiters and not all in the same order. I there are samples out there than can do it using T-SQL, that will be great. Here are 2 examples, I...
  15. NeilO123

    Can a store procedure be written in c#

    Thanks to all for the prompt response. I did a google search on the topic but what I got back is "how to call store procedure" but not how to write the procedure in C# or Visual Basic. I can not use T-Sql due to limitations and I am stuck with the database design. Agin any help is welcome. NeilO
  16. NeilO123

    Can a store procedure be written in c#

    Can a store procedure be written in c# or Visual Basic using Visual Studio 2005 against a SQL Server 2005? I need to do a column parsing into other columns within the same row, in a multirow table. I would like to know, if I can convert my code into store procedure. If its possible, are there...
  17. NeilO123

    Stored Procedure to insert a table into another table Problem

    Thanks for pointing the obvious (I totally missed it).
  18. NeilO123

    Stored Procedure to insert a table into another table Problem

    I am trying to copy data from one table into another, the message that I receive is that is done. but data is not copied?? This is my proc: --- USE RUMS GO ---Drop procedure if it exist IF (SELECT OBJECT_ID('dbo.hits_transfer','P')) IS NOT NULL - BEGIN DROP PROC dbo.hits_transfer END GO...

Part and Inventory Search

Back
Top