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. TJRTech

    parameter with multiple values

    bbeeharry asks: "i have a parameter which can take multiple values. how can i reprent this in my sql?" Okay, others seem to be answering this question as if bbeeharry is asking about passing multiple values at a time in a single parameter. But what if he is asking about a parameter which is...
  2. TJRTech

    Select vbCRLF as part of a string for Insert

    If you are truly looking for HTML formating then CrLf (vb or not) will NOT give you a line break and you will need to use <br> which you seem to be avoiding. I have written several stored procedures in the past that use SqlMail to send emails, they format the text of the email, and they use...
  3. TJRTech

    UDF to convert currency to English string

    I know it was a lot to read there, and asking a little that people cut/paste to examine code, but does anyone have any comments whatsoever? Thanks. TJR
  4. TJRTech

    UDF to convert currency to English string

    Almost forgot, the UDF uses the following table to lookup words given numbers: -- *** NumberString *** if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[NumberString]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table [dbo].[NumberString] GO CREATE TABLE...
  5. TJRTech

    UDF to convert currency to English string

    It's been a while since I posted or helped out some folks here, but I am back with a question. I have a website I am working on that has to display a currency value as stored in the database as a text string. It has to optionally display cents if available, and deal with values into the 100s of...
  6. TJRTech

    normalizing data

    Chrissie1, sometimes NULL is an acceptable input value for a table...for example, in those cases where NO VALUE is possible and you want to allow for that.
  7. TJRTech

    normalizing data

    First of all, go to SQL Books Online and take a look at ISNULL(). 80% of the query is replacing stock column values with 'NO SPEC' via CASE statements when NULL, and that is exactly what ISNULL is good for. You may feel better about the query after doing that simple bit of housecleaning...and...
  8. TJRTech

    Last 12 months

    I think you are on the right track. Assuming you have a table, and it has a date/time column, than something like this should work: SELECT * FROM <table> WHERE <date_column> >= dateadd(mm, -12, GetDate())
  9. TJRTech

    Help with validating date

    Furthermore, as you probably now see, you should use isdate() as a PART of your total solution, whether that solution be an UPDATE statement (see my post above), a function used in an update statement, etc. Isdate() doesn't RETURN a valid date, it simply tells you when given a char field is...
  10. TJRTech

    Help with validating date

    Correct, jbenson001...Kizzie, I suggest you do less "talking" to people and more reading on this forum and the Books On Line, and trying to understand them. People have been saying use isdate, isdate, isdate, isdate, and in two threads you dismissed them all. That many people are not usually...
  11. TJRTech

    Help with validating date

    Sorry, but I am sure you are wrong. Isdate DOES work on char fields...that is what it was meant for. This test shows that it works: CREATE TABLE #FOO ( DATESTR varchar(25), bWasDate bit, ) INSERT INTO #FOO values('1/20/2005', 1) INSERT INTO #FOO values('20050125', 1) INSERT...
  12. TJRTech

    Help with validating date

    Kizzie, you have two threads where you are working on the same problem; that is frowned upon here. The other thread is: http://www.tek-tips.com/viewthread.cfm?qid=1102759 Note that isdate() does work against char fields, even with nulls. Consider the following and their results in comments...
  13. TJRTech

    Help with validating date

    Kizziebutler says: "I need to validate against all the fiels in the database." I really suspect you don't mean that. Because when you say fields, I hear "columns", not values or or records. I suspect you mean that there are several known var/char fields in several tables that you need to...
  14. TJRTech

    using SQL to ping computers

    Take a look at this thread: http://www.tek-tips.com/viewthread.cfm?qid=834286 TJR
  15. TJRTech

    change char to datefield and then validate the date

    jbenson001 asked what the question because it seems you posted valid SQL that will do what you are looking for and could be incorporated into a SP, a view, a function, whatever. So, what is the problem with what you posted? TJR
  16. TJRTech

    How to calculate age

    A question to you all.... If I was born on 01/31/2000 (Jan, 31, 2000), and TODAY is February 28th, 2005 how many yy, mm and days old am I? My kneejerk tells me that I am: 5 years, 1 month, and 0 days old I say this because February 28th is one month after Jan 31st. Am I correct? Or...
  17. TJRTech

    How to calculate age

    I see why now...the -3 days issue...hhmmm, time to noodle. TJR
  18. TJRTech

    How to calculate age

    Again, maybe I am missing something, but why isn't this as easy as three simple calcs: DECLARE @bdate as datetime SET @bdate = '03/09/2005' SELECT datediff(yy, @bdate, GetDate()) as Years SELECT datediff(mm, @bdate, GetDate()) % 12 as Months SELECT datediff(dd, dateadd(mm, datediff(mm...
  19. TJRTech

    How to calculate age

    Assuming today is 2005-07-27, than the Months and Days since the birthdate of 2005-03-09 if 4mo 18 days, right? The following will give you that: DECLARE @bdate as datetime SET @bdate = '2005-03-09' SELECT datediff(mm, @bdate, GetDate()) as AgeInMonths SELECT datediff(dd, dateadd(mm...
  20. TJRTech

    Stored procedure arguments

    Agh, not for nothing, but you say you couldn't find any information on this, then you conclude that a Google search would have helped. I ask, did you check SQL Server Books Online and the T-SQL reference? The following is an excerpt from the CREATE PROCEDURE documentation: Syntax CREATE...

Part and Inventory Search

Back
Top