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...
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...
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
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...
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...
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.
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...
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())
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...
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...
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...
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...
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...
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
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...
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...
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...
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...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.