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 derfloh 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: *

  • Users: newtosql
  • Content: Threads
  • Order by date
  1. newtosql

    cursor error

    Im using SQL 7.0 and deleting a rows with cursor from user tables. If productID in exists in one of my ProductHistory tables and if the productID in the master table "Products" is less than a certain date then I want to delete it. I get an error msg (follows): Server: Msg 137, Level 15...
  2. newtosql

    select part of an email address

    I need to write some sql to select just the characters following the @ sign in a column of email addresses. Any ideas? Thanks guys :-)
  3. newtosql

    Query to remove entries from table1 that exist in table 2

    Im new to sql server. I have two tables, I need to write a query that will take the values out of one table if they exist in another table. Each table has one column only and they are varchar(250). Each table has approx 20,000 rows. I need to remove entries from table1 that already exist in...
  4. newtosql

    exclude null values

    Im new to sql and Id like to exclude null values from my query. When I run my query (in query analyzer) I still see the null values that I want to exclude. select col_a from tabl_a (nolock) where (NOT (col_b IS NULL)) Any ideas? Thanks guys.
  5. newtosql

    Where to put brackets and < >

    I have an if statement that I need to alter but Im unsure of where to put the ( )'s and <> IF (SELECT COUNT(msecs) FROM [tablename] WHERE (CONVERT(int, msecs)/1000)/3600 >2 )>=1 BEGIN ...... I need &quot;>2&quot; part show greater than 1 and less than 3. Thanks for you help!
  6. newtosql

    Im missing a bracket!!

    Can anyone tell me where Im missing a bracket? ')' if (select COUNT(ms) FROM [table_name] WHERE (CONVERT(int, ms)/1000)/3600) > 3 begin .... Thanks!
  7. newtosql

    error msg &quot;cant convert data type datetime to type int&quot;.

    create procedure sp_display_activity @loginid int, @date datetime as select * from LoginActivity where [date] = @date and loginid = @loginid Im having difficulty returning values from my stored procedure that accepts 2 parameters of &quot;date&quot; and &quot;loginID&quot;. I get an...
  8. newtosql

    RAND function

    Does anyone know what Im doing wrong? I get an error msg saying invalid use of RAND within a function. Thanks! CREATE FUNCTION RandString -- Input length of string to be returned (@LenString int ) RETURNS char(50) AS BEGIN DECLARE @position int, @AtoZstring char(26), @ResultString...
  9. newtosql

    Union query ... is what I want possible?

    If I have the following... SELECT DISTINCT STREET FROM TableA UNION SELECT DISTINCT STREET DEPENDENT_STREET FROM TableA WHERE STREET IS NOT NULL AND DEPENDENT_STREET IS NOT NULL ...and for each result returned I want to do SELECT TEXT_ID FROM TableB WHERE STREET=['a parameter I will...
  10. newtosql

    Writing a date function

    Hi, I think I need to write a function to avoid using this query over and over again. CAST(DATEPART(YEAR,getdate()) AS VARCHAR) + REPLICATE('0',2-LEN(CAST(DATEPART(MONTH,getdate()) AS VARCHAR))) + CAST(DATEPART(MONTH,getdate()) AS VARCHAR) +...
  11. newtosql

    Re-format column to include an ID.

    Hiya, I have a table listing 2000 item_names such as 'coastal', 'mountain', 'rescue' and so on. Each of these items has a task_id which represents the amount of time that may elapse before the 'item_instructions' for each item should be completed. I need to reformat the task_id column so that...
  12. newtosql

    How to convert/re-format column values

    I need to get the values from a column (small example shown on the left) convert them (it &quot;sort-of&quot; represents minutes) from an excel file into a new sql format (on the right) which represents a new incrementing ID (note: single digits always prefixed by '0') and then hours (HH) and...

Part and Inventory Search

Back
Top