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 strongm 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. Nagrom

    Top X question

    vongrunt, Shouldn't that be "A.OrderCount>=B.OrderCount" rather than "A.OrderCount<=B.OrderCount"? (not trying to flame - just clarifying because I want to use a statement like that) A very elegant solution - a gold start for you, Sir (or Madam, as the case may be - please pardon any...
  2. Nagrom

    Date sorting

    If you're only storing date values in those fields, actually create the fields as datetime data types. Then you can sort them reliably and just output the converted format (though the conversion codes 102 and 120 should be sorting them correctly since they return the data in yyyymmdd order).
  3. Nagrom

    looping through a record set

    There are two different sets of SQL statement types you can use for each of these that would be faster than looping through each of the records in the recordset individually. They are the "insert into... select..." and "update... from..." statements. The first type, "insert into... select..."...
  4. Nagrom

    Top X question

    vongrunt, Can you post an example of how you would do that? I've been tasked with something similar in the past and never found a single statement that could do it. I'd love to find a solution that didn't require cursors or some other kind of looping (which is what I ended up implementing in a...
  5. Nagrom

    need help with error -2147217871 ODBC time out

    Is each insert a separate statement? That shouldn't be happening if they are all being inserted by a single statement because it is one transaction and none of the new records should be committed in the database if the transaction did not complete. You can ensure that happens by putting the...
  6. Nagrom

    looping through a record set

    Are you actually inserting new rows into a table or updating existing rows? In your example you're adding the values in Field3 and Field4 of Table1, which suggests you're working with an existing row, but later you say you need to "insert calculated values" into Table1.
  7. Nagrom

    Top X question

    I hate to speak in absolutes, but I think it's safe to do so here: There's no way to do that with a single SQL statement. That being said, you can "simulate" a single SQL statement (to your code, at least) by packaging the necessary steps into a stored procedure and then executing that stored...
  8. Nagrom

    Execute a stored procedure from within a query

    From the looks of things what you really want to do is create a user defined function. You can create a UDF like this: CREATE function dbo.getOverallScore (@emp_id int) returns int as begin declare @Score int select @Score = Avg(SingleScore) from MyScoreData (nolock) return @Score end
  9. Nagrom

    String or binary data would be truncated.

    Unfortunatey the stored proc won't tell you which is the offending column. There is an easy way to figure out what is doing it though. Just copy the code from the stored procedure into Query Analyzer and execute the SQL directly (you may have to declare and explicitly set variables if you had...
  10. Nagrom

    Move whole site to a new folder

    If all you want to do is let the users come to the old URL and hit the new location it would be better to just create a virtual directory on the web server with the old folder name that actually points to the new folder. That way you don't have to worry about creating files to redirect the user...
  11. Nagrom

    limit results to an aggregate function total

    If you want all donors meeting that criteria then you need to take out the "donor_id= 3890" part - otherwise that's the only donor you'll ever get.
  12. Nagrom

    Windows Password Authentication

    Also, you might get more responses to this question in the VB WIN32API forum.
  13. Nagrom

    Windows Password Authentication

    I can't find the specifics of the API to be sure, but I'm betting the call is probably failing because the user is already logged on to that machine (since by the code you are logging them in to the local machine).
  14. Nagrom

    Select and Indexes

    I'm a little unclear on what you mean by an optimum number of indexes. Are you referring to the number of indexes on a given table, or indexes specified within the select statement itself? If what you are asking is what is the optimum number of indexes to put onto a table then the answer is...
  15. Nagrom

    ORDER BY CASE WHEN Syntax error converting character string to smallda

    Assuming this code is in a stored procedure, you would want to drop the temp table as soon as you are done working with the data. If all you are doing is returning the data then you would drop the table immediately after the exec statement. If you don't drop it explicitly the table would drop...
  16. Nagrom

    ORDER BY CASE WHEN Syntax error converting character string to smallda

    I'm not sure about why the ORDER BY is setting the data type, but I have a suggestion on how to get around it. If you take your query and load the results into a temporary table you can then generate and execute dynamic SQL to return the data ordered as you like. Basically it would be something...
  17. Nagrom

    Need query help - row processing

    Whoops. Sorry about that - I thought I was in the ASP forum. :P
  18. Nagrom

    Need query help - row processing

    I'm not sure why you would want the pause either, but you could loop through fetching 10 records at a time based on the ID. Assuming you have an integer variable "intStartingRow", a database connection "objConn", a recordset object "objRS", and a string variable "strSQL" you could do it like...
  19. Nagrom

    ASP Page Cannot Connect to SQL Server-Not associated with a trusted co

    I haven't tried this so I'm not sure if it would work, but you could try setting up an ODBC datasource that connects to the database using windows authentication, then specify that DSN with the UserID and Password. That might let you specify a different UserID than the web service. Just try...
  20. Nagrom

    Set a minimum value column constraint?

    We're only using the money data type on fields that actually hold monetary data and we're not doing any complex calculations with them so the precision is sufficient for what we have it used for, but that's definitely something good to keep in mind for future development.

Part and Inventory Search

Back
Top