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!

Recent content by newtosql

  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

    by the way...when I use this query in a View, my query doesnt return any null values (which is what I want). So why doesnt this work in query analyzer?
  5. newtosql

    exclude null values

    Hmm, that doesnt work. Im still seeing NULLs in my results set in query analyzer. Its a datetime column. Is there anything else I should be trying?
  6. 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.
  7. 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!
  8. 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!
  9. newtosql

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

    Ok, I havent released this to users yet as I cannot get it working myself! lol. I AM placing quotes around the date tho. To explain further I have in my table: Login Date Name --------------------------------------- 1433 12/01/2004 12:15:02 Smith I want to...
  10. newtosql

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

    The user will type the date parameter in query analyzer. Im not sure whats going wrong as Im entering my date parameter with quotes around it. How would I convert the users input and add the time to it?
  11. newtosql

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

    Hmmm this doesnt work. In the table, my date column is datetime datatype and displays dates/times as &quot;12/01/2004 12:00:00&quot;. I want my user to type only &quot;12/01/2004&quot; into the stored procedures date parameter and for the procedure to display results without having to specify...
  12. 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...
  13. 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...
  14. newtosql

    Union query ... is what I want possible?

    Sorry, I wasnt very clear on that! TableA contains column named 'street' which is common to TableB. The first query... SELECT DISTINCT STREET FROM TableA UNION SELECT DISTINCT STREET DEPENDENT_STREET FROM TableA WHERE STREET IS NOT NULL AND DEPENDENT_STREET IS NOT NULL ... will produce...
  15. 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...

Part and Inventory Search

Back
Top