Retirement Age Blues

Aug 8, 2006

Datediff won't give you an age.

For example:

SELECT (((DATEDIFF(DAY,BIRTHDATE,GETDATE())) / 30) / 12) as AGE

is CLOSE but not accurate. Is there another function I should consider in determining age?

Semper fi and Thanks!

Semper fi,
XERXES, USMC(Ret.)
------------------------------------------------------
The Marine Corps taught me everything but SQL!

View 7 Replies


ADVERTISEMENT

Dataset Blues

Nov 2, 2007

i don't know if this is the right forum for this question but here goes.  I have created a gridview to display a list of records retrieved by a SQL query.  Everytime I run it, I get the following error:
Object must implement IConvertible.
 
I thought it might have to do with the data I'm passing in the session string from the previous page.  Here is that code:Protected Sub cmdSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdSubmit.Click
Session.Add("Shift", shShift.SelectedItem)Session.Add("Type", shType.SelectedItem)
Session.Add("SelDate", OccDate.SelectedDate)
Response.Redirect("SelectIncRep.aspx")
 
Here is the code that is supposed to execute and display the data on page_init:
 
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="RID" DataSourceID="SqlDataSource1" Width="1215px" BorderStyle="Groove" BorderWidth="4px">
<Columns>
<asp:BoundField DataField="RID" HeaderText="Record ID:" InsertVisible="False" ReadOnly="True"
SortExpression="RID" />
<asp:BoundField DataField="Date" HeaderText="Date:" SortExpression="Date" />
<asp:BoundField DataField="Shift_ID" HeaderText="Shift:" SortExpression="Shift_ID" />
<asp:BoundField DataField="Xref_ID" HeaderText="Type Of Occurence:" SortExpression="Xref_ID" />
<asp:BoundField DataField="Notes" HeaderText="Notes:" SortExpression="Notes" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:PerfDataConnectionString %>"
SelectCommand="SELECT [RID], [Notes], [Date], [Shift_ID], [Xref_ID] FROM [Safety_data] WHERE (([Shift_ID] = @Shift_ID) AND ([Xref_ID] = @Xref_ID) AND ([Date] = @Date))">
<SelectParameters>
<asp:SessionParameter Name="Shift_ID" SessionField="Shift_ID" Type="Int32" />
<asp:SessionParameter Name="Xref_ID" SessionField="Type" Type="Int32" />
<asp:SessionParameter Name="Date" SessionField="Date" Type="DateTime" />
</SelectParameters>
</asp:SqlDataSource>
 
What could be causing the issue?

View 5 Replies View Related

DTS Importing Blues -- Can Anyone Help?

Nov 18, 1999

I am importing via DTS a .csv file. I have 2 issues:

-One field from the source needs to be inserted into two existing fields.

-Two fields from the source, First_Name and Last_Name need to be
concatenated to a destination field, Full_Name.

I do not know VB but I do know SQL.

Can anyone help?

View 3 Replies View Related

INSERTs Given Me The BLUES

Mar 22, 2006

cstring = cstring + "VALUES('%" + txtWatchID.Text + "%','%" + txtcenter + "%'" & _

cstring = "INSERT INTO tblNEW (watch_id, service_center_num, repair_envelope, store_number"

cstring = cstring + "date_purchase, transaction_num, cust_fname, cust_lname, product_code"

cstring = cstring + "value_watch, failure_date, service_date, failure_code, repair_code"

cstring = cstring + "service_request, store_number_senditem, register_number, street_address"

cstring = cstring + "city, state, zip_code, area_code, phone_num, product_desc, service_center"

cstring = cstring + " work_to_bdone, auth_num, labor_cost, parts_cost, tax_cost, total_cost"

cstring = cstring + "notes, client_number)"

cstring = cstring + "VALUES('%" + txtWatchID.Text + "%','%" + txtcenter + "%'" & _



this is the error is get, but i did the same thing on a select statement and it works fine...do i need to add something to the string or what i am kinda confused and help would be great.....

Operator '+' is not defined for types 'String' and 'System.Windows.Forms.TextBox'.

View 15 Replies View Related

Cursor Declaration Blues

Dec 7, 1999

Hi!

While working for a client on a SQL Server 6.5 SP5a, I got the following error when running the code below in first SQL Enterprise Manager 6.5 and then SQL Query Analyzer 7.0:

IF @Departures = 1
DECLARE TableCursor CURSOR
FOR SELECT AcType,
BackPax = CASE BackPax
WHEN NULL THEN 0 ELSE BackPax END,
BestPax = CASE BestPax
WHEN NULL THEN 0 ELSE BestPax END,
DepTime,
FlightNumber,
ArrStn
FROM #TimeCall
ORDER BY DepTime, FlightNumber
ELSE
DECLARE TableCursor CURSOR
FOR SELECT AcType,
BackPax = CASE BackPax WHEN NULL THEN 0 ELSE BackPax END,
BestPax = CASE BestPax WHEN NULL THEN 0 ELSE BestPax END,
ArrTime,
FlightNumber,
DepStn
FROM #TimeCall
ORDER BY ArrTime, FlightNumber

And the error I get when the query is run for the first time after switching tool:

Server: Msg 202, Level 11, State 2, Procedure CreateFile, Line 178
Internal error -- Unable to open table at query execution time.
Server: Msg 202, Level 11, State 1, Procedure CreateFile, Line 188
Internal error -- Unable to open table at query execution time.

If I run the query again in one of the tools, it works. It also works if I use WITH RECOMPILE in the stored proc header.

If I use the code below, it also works, and without RECOMPILE:

DECLARE @SqlStr varchar( 255 )

IF @Departures = 1
SELECT @SqlStr = 'DECLARE TableCursor CURSOR ' +
'FOR SELECT AcType, ' +
'BackPax = CASE BackPax WHEN NULL THEN 0 ELSE BackPax END, ' +
'BestPax = CASE BestPax WHEN NULL THEN 0 ELSE BestPax END, ' +
'DepTime, FlightNumber, ArrStn ' +
'FROM #TimeCall ORDER BY DepTime, FlightNumber'
ELSE
SELECT @SqlStr = 'DECLARE TableCursor CURSOR ' +
'FOR SELECT AcType, ' +
'BackPax = CASE BackPax WHEN NULL THEN 0 ELSE BackPax END, ' +
'BestPax = CASE BestPax WHEN NULL THEN 0 ELSE BestPax END, ' +
'ArrTime, FlightNumber, DepStn ' +
'FROM #TimeCall ORDER BY ArrTime, FlightNumber'
EXECUTE( @SqlStr )

Trying to get around the problem with the following code did not do any good:

DECLARE TableCursor CURSOR FOR
SELECT AcType,
BackPax = CASE BackPax WHEN NULL THEN 0 ELSE BackPax END,
BestPax = CASE BestPax WHEN NULL THEN 0 ELSE BestPax END,
CurTime = CASE @Departures
WHEN 1 THEN DepTime
ELSE ArrTime END,
FlightNumber,
OtherStation = CASE @Departures
WHEN 1 THEN ArrStn
ELSE DepStn END
FROM #TimeCall
ORDER BY CurTime, FlightNumber

Server: Msg 202, Level 11, State 2, Procedure CreateFile, Line 176
Internal error -- Unable to open table at query execution time.

Anyone have some good ideas on why this happens?

Brgds

Jonas Hilmersson

View 1 Replies View Related

RS2005 Setup Blues

Jul 10, 2007

I installed RS2005(SP2) with a SQL2000(sp4) db. Both are on seperate Windoes 2003 servers. I configured the reports manager to connect to a different web site on the same server instead of default web site. There were no installation prohlems. The RS server is up and running , all the virtual directories setup etc. When I try to access the reports directory via: http://dev2/Reports or browse the reports virtual directory from IIS, I get a 401 access denied error. The RS log reads:

<Header>
<Product>Microsoft SQL Server Reporting Services Version 9.00.3042.00</Product>
<Locale>en-US</Locale>
<TimeZone>Eastern Daylight Time</TimeZone>
<Path>D:ReportingServices2005MSSQL.1Reporting ServicesLogFilesReportServerWebApp__07_10_2007_11_29_21.log</Path>
<SystemName>NWISTCST99</SystemName>
<OSName>Microsoft Windows NT 5.2.3790 Service Pack 2</OSName>
<OSVersion>5.2.3790.131072</OSVersion>
</Header>
w3wp!library!1!7/10/2007-11:29:22:: i INFO: Initializing ReportBuilderTrustLevel to '0' as specified in Configuration file.
w3wp!library!1!7/10/2007-11:29:22:: i INFO: Initializing MaxActiveReqForOneUser to '20' requests(s) as specified in Configuration file.
w3wp!library!1!7/10/2007-11:29:22:: i INFO: Initializing MaxScheduleWait to default value of '1' second(s) because it was not specified in Configuration file.
w3wp!library!1!7/10/2007-11:29:22:: i INFO: Initializing DatabaseQueryTimeout to default value of '30' second(s) because it was not specified in Configuration file.
w3wp!library!1!7/10/2007-11:29:22:: i INFO: Initializing ProcessRecycleOptions to default value of '0' because it was not specified in Configuration file.
w3wp!library!1!7/10/2007-11:29:22:: i INFO: Initializing RunningRequestsScavengerCycle to default value of '30' second(s) because it was not specified in Configuration file.
w3wp!library!1!7/10/2007-11:29:22:: i INFO: Initializing RunningRequestsDbCycle to default value of '30' second(s) because it was not specified in Configuration file.
w3wp!library!1!7/10/2007-11:29:22:: i INFO: Initializing RunningRequestsAge to default value of '30' second(s) because it was not specified in Configuration file.
w3wp!library!1!7/10/2007-11:29:22:: i INFO: Initializing CleanupCycleMinutes to default value of '10' minute(s) because it was not specified in Configuration file.
w3wp!library!1!7/10/2007-11:29:22:: i INFO: Initializing DailyCleanupMinuteOfDay to default value of '120' minutes since midnight because it was not specified in Configuration file.
w3wp!library!1!7/10/2007-11:29:22:: i INFO: Initializing WatsonFlags to default value of '1064' because it was not specified in Configuration file.
w3wp!library!1!7/10/2007-11:29:22:: i INFO: Initializing WatsonDumpOnExceptions to default value of 'Microsoft.ReportingServices.Diagnostics.Utilities.InternalCatalogException,Microsoft.ReportingServices.Modeling.InternalModelingException' because it was not specified in Configuration file.
w3wp!library!1!7/10/2007-11:29:22:: i INFO: Initializing WatsonDumpExcludeIfContainsExceptions to default value of 'System.Data.SqlClient.SqlException,System.Threading.ThreadAbortException' because it was not specified in Configuration file.
w3wp!library!1!7/10/2007-11:29:22:: i INFO: Initializing SecureConnectionLevel to default value of '1' because it was not specified in Configuration file.
w3wp!library!1!7/10/2007-11:29:22:: i INFO: Initializing DisplayErrorLink to 'True' as specified in Configuration file.
w3wp!library!1!7/10/2007-11:29:22:: i INFO: Initializing WebServiceUseFileShareStorage to default value of 'False' because it was not specified in Configuration file.
w3wp!ui!5!7/10/2007-11:29:30:: e ERROR: The request failed with HTTP status 401: Unauthorized.
w3wp!ui!5!7/10/2007-11:29:31:: e ERROR: HTTP status code --> 500
-------Details--------
System.Net.WebException: The request failed with HTTP status 401: Unauthorized.

at Microsoft.SqlServer.ReportingServices2005.RSConnection.GetSecureMethods()

at Microsoft.ReportingServices.UI.Global.RSWebServiceWrapper.GetSecureMethods()

at Microsoft.SqlServer.ReportingServices2005.RSConnection.IsSecureMethod(String methodname)

at Microsoft.SqlServer.ReportingServices2005.RSConnection.ValidateConnection()

at Microsoft.ReportingServices.UI.ReportingPage.EnsureHttpsLevel(HttpsLevel level)

at Microsoft.ReportingServices.UI.ReportingPage.ReportingPage_Init(Object sender, EventArgs args)

at System.EventHandler.Invoke(Object sender, EventArgs e)

at System.Web.UI.Control.OnInit(EventArgs e)

at System.Web.UI.Page.OnInit(EventArgs e)

at System.Web.UI.Control.InitRecursive(Control namingContainer)

at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
w3wp!ui!5!7/10/2007-11:29:32:: e ERROR: Exception in ShowErrorPage: System.Threading.ThreadAbortException: Thread was being aborted.
at System.Threading.Thread.AbortInternal()
at System.Threading.Thread.Abort(Object stateInfo)
at System.Web.HttpResponse.End()
at System.Web.HttpServerUtility.Transfer(String path, Boolean preserveForm)
at Microsoft.ReportingServices.UI.ReportingPage.ShowErrorPage(String errMsg) at at System.Threading.Thread.AbortInternal()
at System.Threading.Thread.Abort(Object stateInfo)
at System.Web.HttpResponse.End()
at System.Web.HttpServerUtility.Transfer(String path, Boolean preserveForm)
at Microsoft.ReportingServices.UI.ReportingPage.ShowErrorPage(String errMsg)




Please advise.

The RSweApplication.config in the ReportManager folder has the fully qualified URL to ReportServer<ReportServerUrl> and I have blanked out the <ReportServerVirtualDirectory>



Also the <UrlRoot> in rsreportserver.config in ReportServer folder points to the fully qualified URL to ReportServer.



What am I missing here ..?

View 6 Replies View Related

Linked Server Blues...msg 7319

Apr 24, 2001

Hi,

I have a linked server on two of my other servers. On one server, I can run linked queries just fine. On the other, I get the following error:

Server: Msg 7319, Level 16, State 1, Line 1
OLE DB provider 'SQLOLEDB' returned a 'NON-CLUSTERED and NOT INTEGRATED' index 'LOCATOR_ID' with incorrect bookmark ordinal 0.

I have SQL 7.0 SP2 on both of the linking servers, and the linked server is SQL 6.5. Both querying servers are also using MDAC 2.1

Any insight anyone could provide would be appreicated.

Joe

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved