How To Convert Rtf To Text From A SQL Server Database Table Using A Function?
Nov 2, 2004
Hello,
Can anyone tell me, how to convert an rtf string to text string using a function in SQL Server? I got a table in SQL Server database with field datatype text(16), which holds an rtf. I've to extract it as a text using a function.
thank you,
View 1 Replies
ADVERTISEMENT
Jul 23, 2005
Does anyone have the logic to convert RTF formatted data in a textcolumn into plain ascii text that I can use in a varchar variable orfield?We have an app that allows formatted comments/notes to be stored in aSQL 2000 text column. Ideally, I would like a trigger that would copyany inserted comments into a seperate table, varchar field so thatthese are viewable in other apps that can not display formatted RTF.I would really like the logic to be all SQL based and not have to use aclient app to read/convert/insert the data in a batch mode.
View 1 Replies
View Related
Jul 20, 2005
Does anyone know where to find or how to write a quick user defined fucntionthat will return a table object when passed the string name of the tableobject. The reason why I want dynamicallly set the table name in a storedprocudue WITHOUT using concatination and exec a SQL String.HenceIf @small_int_parameter_previous = 1 then@vchar_tablename = "sales_previous"else@vchar_tablename = "sales"Endselect * from udf_TableLookup(@vchar_tablename )So if I pass 1, that means I want all records from "sales_previous"otherwise give me all records from "sales" (Sales_Previous would last yearssales data for example).udf_TableLookup would I guess lookup in sysobjects for the table name andreturn the table object? I don't know how to do this.I want to do this to avoid having 2 stored procedures..one for current andone for previous year.Please respond to group so others may benfiit from you knowledge.ThanksErik
View 2 Replies
View Related
Feb 7, 2008
I'm searching functions to convert hexadecimal into decimal or bin to hex or more.....
I did'nt find anything yet...
Thanks in advance
Laurent
View 3 Replies
View Related
Feb 5, 2008
Hi
I know this is going to sound embarassingly obvious, but i cannot find a quick solution.
I have some data, I display that data in a table. Simple so far.
I have a table footer, which I want to display the total number of rows returned.
For example
"Total Rows Returned ="
Now I know how to get the total rows returned:
CountRows("Dataset1")
However when I try to put the two together like this:
= "Total Rows Returned =" + CountRows("Dataset1")
I just get the whole thing outputted, and no total for totalrows...
Anyone know what I am doing wrong?
View 6 Replies
View Related
Nov 9, 2006
Hello Everyone,
I do not see the forum for Reporting Services, so I will post this here for now. I have a VB Script that I would like to use as a Function to return the Weekday Name for me in Reporting Services.
[code]
Function rDateTime(rDate, rTime)
DIM myDay, myDayName, myMonthName , myYear, myTime
DIM myAMPM, myHour, myColon, myMinute
'get AM or PM from the time
myAMPM = Right(rTime,2)
'get Hour and Minute
myColon = instr(1, rTime, ":",vbBinaryCompare)
IF myColon = 2 THEN
myHour = Left(rTime,1)
myMinute = Mid(rTime, 3, 2)
ELSE
myHour = Left(rTime,2)
myMinute = Mid(rTime, 4, 2)
END IF
'concatenate the time
myTime = myHour & ":" & myMinute & " " & myAMPM
'get weekday number
myDayName = weekday(rDate)
'convert weekday number to weekday name
myDayName = weekdayname(myDayName)
'get the day, e.g. oct 19, 2002, will return 19
myDay = Day(rDate)
'get month number
myMonthName = Month(rDate)
'convert month number to month name (abbreviation True)
myMonthName = MonthName(myMonthName, True)
'get the year
myYear = Year(rDate)
'concatenate variables
rDateTime = myDayName & myMonthName & ". " & myDay & ", " & myYear & myTime"
End Function
How should I use this as a funciton in SQL Server Reporting Services? I think that I need to use a calculated field. Am I correct or what do I need to do to implment this. This code will return the Weekday Name which is what I need.
TIA for any help in advance.
Have a great day!
Kurt
View 1 Replies
View Related
Sep 21, 2004
I am facing a problem with Convert function in SQL server 2000 with sp3 installed , Japanese version
In sql server 2000 (sp1 installed) Japanese version, the convert(datetime,,111) gives me date in the format yyyy-mm-dd hh:min:sec
But in sql server 2000 (sp3 instaled) Japanese version, the convert(datetime, ,111) gives me date in the format yyyy-mm-dd.
I need the hh:min:sec to do an exact date comparison.
The problem is solved if I use Convert(datetime,,120).
Any pointers on the root cause of why the problem occurs with convert() function once sp3 is installed?
View 1 Replies
View Related
Jan 26, 2014
Writing a SQL Function as below
the input parameter for function should be datetime of sql datetimeformat
and out put should be a string = yyyymmdd1 or yyyymmdd2
The last character 1 or 2 based on below condition
if time is between 6AM and 5.59PM then 1
if 6PM to 5.59AM then 2
View 6 Replies
View Related
Aug 27, 2014
I have the following data stored in a column in a table:
£10,000.00 & ' " % < > Guðmundsdóttir Björk LÃ¥rs Marqués MarÃa-Jose Carreño Quiñones
I query this in a stored procedure using the FOR XML clause and universal table, and store the result in an XML data type variable:
DECLARE@ResultXML
EXECUTE[someStoredProcedure] @Result OUTPUT
This data (as XML) is then written to a file; in order to do this, I CONVERT the data to NVARCHAR since there are unicode characters in the source:
DECLARE@strResultNVARCHAR(MAX)
SET@strResult= CONVERT( NVARCHAR( MAX ), @Result, 1 )
Now this works fine, except on inspection, SQLServer has decided to render the data thus:
£10,000.00 & ' " % < > Guðmundsdóttir Björk LÃ¥rs Marqués MarÃa-Jose Carreño Quiñones
Why it has changed the apos and quot entities to the corresponding character but not the other entities is beyond me.
how to preserve XML entities?
View 0 Replies
View Related
Aug 1, 2005
I have this function in access I need to be able to use in ms sql. Having problems trying to get it to work. The function gets rid of the leading zeros if the field being past dosn't have any non number characters.For example:TrimZero("000000001023") > "1023"TrimZero("E1025") > "E1025"TrimZero("000000021021") > "21021"TrimZero("R5545") > "R5545"Here is the function that works in access:Public Function TrimZero(strField As Variant) As String Dim strReturn As String If IsNull(strField) = True Then strReturn = "" Else strReturn = strField Do While Left(strReturn, 1) = "0" strReturn = Mid(strReturn, 2) Loop End If TrimZero = strReturnEnd Function
View 3 Replies
View Related
May 11, 2015
Why this won't work. POST_DT is nvarchar(50). I know it should be datetime but, I have no control over it. That's why I'm creating a temp table. But, I want to only insert the most recent invoice. There is code to create test data at the end.
create table #FSC589
(
GRP__2 char(1),
INV_NUM char(8),
MRN varchar(10),
POST_DT datetime
[Code] .....
View 2 Replies
View Related
Feb 23, 2015
I have created a store procedure, but the requirement is function because by using this function we need to add columns in a table with SSIS.
I have tried to create function, but the error I am facing is select statement can not return data.
CREATE PROCEDURE SP_STAT_CURR
(
@I_NET_AMOUNT NUMERIC(10,3),
@I_DOCUMENT_CURR VARCHAR(3),
@I_TARGET_CURR VARCHAR(3)
[code]....
View 9 Replies
View Related
Jul 13, 2006
Our sql server 2005 database is receiving data from a third part program over which we have no control. We need to be able to automatically convert data entered in one column of one table to UPPER case only.
How can this be done in the table itself?
View 3 Replies
View Related
May 29, 2008
Can some one help me convert plain text to reach text format using t-sql
I am on MSSQL 2005
Thanks
View 1 Replies
View Related
Dec 6, 2004
Hello!
I am trying to run a query on an SQL-server database:
SELECT (Left(Comments, 20)) As shortComment FROM myTable
The Field Comments is a Text field (datatype is text), and I can't get the LEFT function to work with this datatype...
How can I bypass this problem? Can I convert the commentfield to varchar in the QUERY?
noccy
View 1 Replies
View Related
Feb 4, 2008
Can anybody know ,how can we add builtin functions(ROW_NUMBER()) of Sql Server 2005 into database library.
I get this error when i used into storeprocedure :
ROW_NUMBER() function is not recognized in store procedure.
i used MS SQL SERVER 2005 , so i think "ROW_FUNCTION()" is not in MS SQL SERVER 2005 database library.
I need to add that function into MS SQL SERVER 2005 database library.
Can anbody know how we can add that function into MS SQL SERVER 2005 database library?
View 4 Replies
View Related
Nov 19, 2014
I'm using SS 2012.
I started with an inline table returning function with a hard coded input table name. This works fine, but my boss wants me to generalize the function, to give it in input table parameter. That's where I'm running into problems.
In one forum, someone suggested that an input parameter for a table is possible in 2012, and the example I saw used "sysname" as the parameter type. It didn't like that. I tried "table" for the parameter type. It didn't like that.
The other suggestion was to use dynamic sql, which I assume means I can no longer use an inline function.
This means switching to the multi-line function, which I will if I have to, but those are more tedious.
Any syntax for using the inline function to accomplish this, or am I stuck with multi-line?
A simple example of what I'm trying to do is below:
Create FUNCTION [CSH388102].[fnTest]
(
-- Add the parameters for the function here
@Source_Tbl sysname
)
RETURNS TABLE
AS
RETURN
(
select @Source_Tbl.yr from @Source_Tbl
)
Error I get is:
Msg 1087, Level 16, State 1, Procedure fnTest, Line 12
Must declare the table variable "@Source_Tbl".
If I use "table" as the parameter type, it gives me:
Msg 156, Level 15, State 1, Procedure fnTest, Line 4
Incorrect syntax near the keyword 'table'.
Msg 137, Level 15, State 2, Procedure fnTest, Line 12
Must declare the scalar variable "@Source_Tbl".
The input table can have several thousand rows.
View 9 Replies
View Related
Apr 24, 2015
I would like to create a table valued function that fetch through the table below using a cursor and return the records that are unique
EmpidChDateSiteuseridinitsal finsalNote
-------------------------------------------- ----------
236102015-4-21 22:02:10.8072570 0.696176161 change inisal value
236112015-4-21 22:02:11.0502570 0.696176161change inisal value
236122015-4-21 22:02:11.1202570 0.696176161 change inisal value
236132015-4-21 22:02:11.2452570 0.696176161change inisal value
View 9 Replies
View Related
Oct 15, 2001
Ho do I convert Oracle 8 database into SQL server 7.0 database ? Is it possible ? Please let me know at skbhaduri@rediffmail.com
View 1 Replies
View Related
Sep 20, 2006
I am trying to concatenate a string to a currency amount so that I can show both in a drop down list box. However when I create the SQL to do this using the Query tool I get a message to say that I must use the Convert funtion to convert the currency amount.Anyone know the SQL syntax for this function as I can seem to get it to work. ThanksPaul
View 3 Replies
View Related
Jul 13, 2004
I'll go right to the point:
I have a textbox in wich the user can seize a "money" value.
But when i'm doing the INSERT command, it fails and says I cannot implicitely convert nvarchar data (mytextbox.text) to money data.
I don't know how to handle this...
objCmd = New SqlCommand("INSERT INTO tbl_appel_service_pieces " & _
"(fld_nom_piece, fld_quantite, fld_prix, fld_description, fld_num_appel) " & _
"VALUES (@fld_nom_piece, @fld_quantite, @fld_prix, @fld_description, @fld_num_appel)", objConn)
objCmd.Parameters.Add("@fld_nom_piece", champsNomPiece.Text)
objCmd.Parameters.Add("@fld_quantite", champsQuantite.Text)
objCmd.Parameters.Add("@fld_prix", champsPrix.Text)
objCmd.Parameters.Add("@fld_description", champsDescription.Text)
objCmd.Parameters.Add("@fld_num_appel", champsNumAppel.Text)
objConn.Open()
objCmd.ExecuteNonQuery()
objConn.Close()
afficherPieces()
How and where to do the conversion ? On the VALUES variable ?
View 3 Replies
View Related
May 20, 2005
Hi, I have found some ways on using Convert() function for SQL server. But i do not understand some of them.
Example:
CONVERT(VARCHAR(10),column name,108)
What is the 108 for? I see some with 120 and 101. I tried all but only 108 is working for me the way I want..but i do not understand what is that for actually. Can anyone explain it to me? Thank you.
View 2 Replies
View Related
Nov 15, 2000
Hi,
Here is the statement I'm trying to run....
declare @A varchar(5)
select @A='123'
select @A=(select convert(money,@A))
select @A
This is the error message I get:
Implicit conversion from data type money to varchar is not allowed. Use the CONVERT function to run this query.
Does anyone know what should I change in the query to make it work?
Thank you very much,
Anastasia.
View 2 Replies
View Related
Dec 2, 1999
Hi all,
I have found an interesting problem with Convert function. When you Use this function to Convert Datetime to varchar and if the date happens to be 01/01/2000 or higher it return nothing. here is an Example.
CREATE TABLE ABC (Id int, Datein Datetime NOT NULL Default getdate())
GO
INSERT INTO ABC VALUES(1,'12/31/1999')
INSERT INTO ABC VALUES(2,'12/31/1999')
INSERT INTO ABC VALUES(3,'12/31/1999')
GO
SELECT *
FROM ABC
WHERE CONVERT(varchar,DateIn,101) < '01/01/2000'
-- This query returns Nothing
SELECT *
FROM ABC
WHERE DateIn < '01/01/2000 00:00:00'
AND DateIn > '12/30/1999 23:59:59'
-- this Query return the 3 row that it is suppose to.
Is there a Fix for this problem that any one know of.
Please, Help .. Or else I will have to do this solution for every time I am useing Convert function.
Thank You very much for your time.
Aziz Vahora
View 1 Replies
View Related
Dec 28, 1999
Hi all,
I have found an interesting problem with Convert function. When you Use this function to Convert Datetime to varchar and if the date happens to be 01/01/2000 or higher it return nothing. here is an Example.
CREATE TABLE ABC (Id int NOT NULL, Datein Datetime NOT NULL)
GO
INSERT INTO ABC VALUES(3,'12/31/1999 01:00:00')
INSERT INTO ABC VALUES(4,'12/31/1999 02:00:00')
INSERT INTO ABC VALUES(5,'12/31/1999 03:00:00')
INSERT INTO ABC VALUES(6,'01/01/2000 03:00:00')
GO
SELECT *
FROM ABC
WHERE CONVERT(varchar,DateIn,101) < '01/01/2000'
GO
-- This query returns Nothing
SELECT *
FROM ABC
WHERE DateIn < '01/01/2000 00:00:00'
AND DateIn > '12/30/1999 23:59:59'
-- this Query return the 3 row that it is suppose to.
Is there a Fix for this problem that any one know of.
Please, Help .. Or else I will have to do this solution for every time I am using Convert function.
Thank You very much for your time.
Aziz Vahora
View 2 Replies
View Related
Jul 30, 2003
Hi, I succesfully transfered my Access database to MS SQL and tried to run my Visual Basic application I got the following error message:
"...Disallowed implicit conversion from data type varchar to data type money, table SALES, column AMOUNT ...Use the CONVERT function to run this query."
Used code looks like:
sSQL = "INSERT INTO sales ([TRIP], [CC], [TRANS], [DATE], [AMOUNT], [GST], [PST], [TOTAL], [NOTE], [CATEG]) VALUES ('" & txtTrip.Text & "', '" & cmbCC.Text & "', '" & txtTrans.Text & "', '" & txtDate.Text & "', '" & txtSubtotal.Text & "', '" & txtGST.Text & "', '" & txtPST.Text & "', '" & txtTotal.Text & "', '" & txtNote.Text & "', '" & cmbCat.Text & "'); "
Set rst = New ADODB.Recordset
rst.Open sSQL, objAccessConnection, adOpenKeyset, adLockOptimistic
Can you please help me fix this error, I am new to MS SQL...
Thanks.
View 6 Replies
View Related
Feb 20, 2005
I get this error when I run this query, How do I use the CONVERT function in this scenario
insert into Inventory (Item_ID,
Inventory_ID,Perishable_indicator, Perishable_Date,
Department_ID, Category, Description, Unit_of_Measure,
Quantity_on_Hand, Unit_Cost, Master_Pack_Quantity,
Supplier_ID)
values
('23456','8263458', 'Yes', 'Feb 25 2005
12:00AM','695', 'Produce', 'Apple', 'per lb', '6000',
'0.99', '10000', '893')
Server: Msg 260, Level 16, State 1, Line 1
Disallowed implicit conversion from data type varchar
to data type money, table 'Final
Project.dbo.Inventory', column 'Unit_Cost'. Use the
CONVERT function to run this query.
View 6 Replies
View Related
Mar 10, 2006
I write using the SQL ODBC driver from software into a SLQ table called UPSSHIPMENT the format is as followed:
JobNumbervarchar50
Weightreal4
FreightCostvarchar8
TrackingNumbervarchar50
Shipmethodvarchar50
VOIDIDvarchar3
I then have a trigger set to update the PACKAGE table as followed
CREATE TRIGGER [UPS] ON dbo.UPSSHIPMENT
FOR INSERT
AS
BEGIN
UPDATE PACKAGE
SET WEIGHT = inserted.WEIGHT,
FREIGHTCOST = inserted.FREIGHTCOST,
TRACKINGNUMBER = inserted.TRACKINGNUMBER,
COMMENTS = inserted.SHIPMETHOD
FROM PACKAGE
INNER JOIN inserted on PACKAGE.JOBNUMBER = inserted.JOBNUMBER
WHERE inserted.VOIDID = 'N'
UPDATE PACKAGE
SET WEIGHT = '',
FREIGHTCOST = '',
TRACKINGNUMBER = '',
COMMENTS = 'UPS VOID'
FROM PACKAGE
INNER JOIN inserted on PACKAGE.JOBNUMBER = inserted.JOBNUMBER
WHERE inserted.VOIDID = 'Y'
END
The format of the PACKAGE table is as followed
Jobnumbervarchar50
FreightCostmoney8
TrackingNumbervarchar50
Commentsvarchar2000
Weightreal4
When the trigger goes off I am getting the following error
---------------------------
Microsoft SQL-DMO (ODBC SQLState: 42000)
---------------------------
Error 260: Disallowed implicit conversion from data type varchar to data type money, table 'TESTing.dbo.Package', column 'FreightCost'. Use the CONVERT function to run this query.
---------------------------
OK
---------------------------
How do you use the convert function to change the data before the update?Thank You!
View 2 Replies
View Related
Jan 9, 2007
Hi
I'm an Access/VB coder by experience and trying to move apps to SQL Server 2000.
I have got to grips with the basics of DTS and tables and views and Stored Procedures (to an extent) but now need to upgrade an app that uses a vb function to produce a phased value for a set of budgets.
The VB function looks like this...
---------------------------------
Function calcPercentOfBudget(datFromDate As Date, datToDate As Date, iMonth As Integer, cBudget As Currency) As Currency
Dim iDuration As Integer
iDuration = DateDiff("d", datFromDate, datToDate) + 1
' if either date not in current year then 0 (both dates should be in same year)
If Year(datFromDate) <> Year(Now) Or Year(datToDate) <> Year(Now) Then
calcPercentOfBudget = 0
End If
Dim sRatio As Single, idaysInMonth As Integer, idaysInYear As Integer
' if passed month outside of period then 0
If Not (iMonth >= Month(datFromDate) And iMonth <= Month(datToDate)) Then
calcPercentOfBudget = 0
Exit Function
End If
idaysInMonth = daysInMonth(iMonth, Year(Now))
'if from date and to date in same month then 100% of budget
If Month(datFromDate) = Month(datToDate) Then
calcPercentOfBudget = cBudget
Exit Function
End If
' if passed month in From month then ratio of passed month (caters for 1st day of month - 100%)
If Month(datFromDate) = iMonth Then
'calcPercentOfBudget = (idaysInMonth + 1 - Day(datFromDate)) / idaysInYear * cBudget
calcPercentOfBudget = (idaysInMonth + 1 - Day(datFromDate)) / iDuration * cBudget
Exit Function
End If
'if passed month in To month then ratio of passed month (caters for last day of month - 100%)
If Month(datToDate) = iMonth Then
'calcPercentOfBudget = Day(datToDate) / idaysInYear * cBudget
calcPercentOfBudget = Day(datToDate) / iDuration * cBudget
Exit Function
End If
' if passed month within period then 100%
If iMonth > Month(datFromDate) And iMonth < Month(datToDate) Then
'calcPercentOfBudget = idaysInMonth / idaysInYear * cBudget
calcPercentOfBudget = idaysInMonth / iDuration * cBudget
Exit Function
End If
End Function
---------------------------------
Function daysInMonth(iMonth As Integer, iYear As Integer) As Integer
Dim datTemp As Date
datTemp = CDate("1/" & CStr(iMonth) & "/" & CStr(iYear))
datTemp = DateAdd("m", 1, datTemp)
datTemp = DateAdd("d", -1, datTemp)
daysInMonth = Day(datTemp)
End Function
---------------------------------
I have a UDF function LastDayInMonth to replace the daysInMonth vb function, and that works fine.
However I'm starting to get frustrated in trying to convert the main VB funciton to a UDF function. This is what I have got to, and as you'll see its totally wrong!...
CREATE FUNCTION [dbo].[calcPercentOfBudget] (@datFrom as datetime, @datTo as datetime , @iMonth as int, @cBudget as money, @GetDate as datetime)
RETURNS money AS
BEGIN
declare @iDuration int
declare @returnvalue money
declare @sRatio decimal
declare @iDaysInMonth int
set @iDuration = datediff(d, @datFrom, @datTo)
set @iDaysinMonth = dbo.LastDayInMonth('1/' + cast(@iMonth as varchar) + '/' + cast(year(@getdate) as varchar))
case
when year(@datFrom) <> year(@getdate) or year(@datTo) <> year(@getdate)
set @returnvalue = 0
when not(@iMonth >= Month(@datFrom) and @iMonth <= month(@datTo)
set @returnvalue 0
when month(@datFrom) = month(@datTo)
@set @returnvalue = @cBudget
when month(@datFrom) = @iMonth
set @returnvalue = (@iDaysInMonth + 1 - day(@datFrom)) / @iDuration * @cBudget
when month(@datTo) = @iMonth
set @returnvalue = Day(datToDate) / iDuration * cBudget
when @iMonth > month(@datFrom) and @iMonth < month(@datTo)
set @returnvalue = @iDaysInMonth / @iDuration * @cBudget
end
return @returnvalue
END
This is my first post to this forum - so any constructive criticism will be welcomed.
Basically, where am I going wrong? - have I got the wrong end of the stick? Have I got the wrong stick? Have I got a stick of dynamite?!
All help greatfully received,
Paul:eek:
View 2 Replies
View Related
Aug 6, 2007
Can u help me transform this code into sql function?
/* Append modulus 11 check digit to supplied string of digits. */
function GenMOD11( $base_val )
{
$result = "";
$weight = array( 2, 3, 4, 5, 6, 7,
2, 3, 4, 5, 6, 7,
2, 3, 4, 5, 6, 7,
2, 3, 4, 5, 6, 7 );
/* For convenience, reverse the string and work left to right. */
$reversed_base_val = strrev( $base_val );
for ( $i = 0, $sum = 0; $i < strlen( $reversed_base_val ); $i++ )
{
/* Calculate product and accumulate. */
$sum += substr( $reversed_base_val, $i, 1 ) * $weight[ $i ];
}
/* Determine check digit, and concatenate to base value. */
$remainder = $sum % 11;
switch ( $remainder )
{
case 0:
$result = $base_val . 0;
break;
case 1:
$result = "n/a";
break;
default:
$check_digit = 11 - $remainder;
$result = $base_val . $check_digit;
break;
}
View 14 Replies
View Related
Jun 9, 2006
chirag writes "
i want to convert datatype numeric to varchar
my query is
====================================================
SELECT ParameterName+' ('+instancename+')' as Item,
CurrentUse as LastPoll,
Threshold +
case Comparer when 'Greater Than' then '( > )'when 'Less Than' then '( < )'end ,
CASE Status WHEN 'Running' THEN 'N' WHEN 'Stopped' THEN 'Y' END as Breach
FROM PARAMETER
======================================================
please solve this query as soon as possible
at
chiragvm@gmail.com
"
View 2 Replies
View Related
Oct 7, 2005
I’m trying to cast and integer type to a varchar and then concatenatetwo varchar and ’01’ and convert it into datetime with the followingcode:CONVERT(datetime, { fn CONCAT({ fn CONCAT(CAST(PeriodYear AS varchar),CAST(PeriodMonth AS varchar)) }, ’01’) }, 112) AS dateIt gives an error saying syntax error converting datetime fromcharacter string.Any help appreciated!!thx..--Posted using the http://www.dbforumz.com interface, at author's requestArticles individually checked for conformance to usenet standardsTopic URL: http://www.dbforumz.com/General-Dis...pict261333.htmlVisit Topic URL to contact author (reg. req'd). Report abuse: http://www.dbforumz.com/eform.php?p=900084
View 4 Replies
View Related
Feb 28, 2007
I have a situation where I want to filter records for a given day. Thefield that stores the date/time uses the date() function as a default value,kind of a date/time stamp for the record.The problem is when I want to filter records for a given day instead of adate range. I use the CONVERT function to return just the date part of thefield (101 as a style parameter) and compare that to a start and stop date(both being the same) and I get nothing. The stored procedure is asfollows:Alter Procedure spESEnrollmentCount@StartDate smalldatetime, @StopDate smalldatetimeAsSELECT tblCustomers.CustomerName, tblCostCenters.CostCenter,COUNT(tblESEnrollments.EnrollmentID)AS [Count of Enrollments]FROM tblESEnrollmentsINNER JOIN tblCustomers ON tblESEnrollments.CustID = tblCustomers.CustIDINNER JOIN tblCostCenters ON tblCustomers.CostCenterID =tblCostCenters.CostCenterIDWHERE ( CONVERT(DATETIME, tblESEnrollments.DTStamp, 101) >= @StartDate) AND( CONVERT(DATETIME, tblESEnrollments.DTStamp, 101) <= @StopDate) AND(Rejected = 0)GROUP BY tblCustomers.CustomerName, tblCostCenters.CostCenterIf I put 10/31/06 in for both parameters shouldn't I get records dated10/31/06 if there are some?Thanks,Wes
View 1 Replies
View Related