Converting @[System::StartTime] To String
Oct 2, 2006
I am trying to get the System::StartTime into a table, but I get this error in my expression builder saying "Cannot convert 'System.DateTime' to 'System.String'
I have tried (DT_TEXT, 1252) @[System::StartTime] but I get the following
Attempted to read or write protected memory. This is often an indication that other memory is corrupt. (Microsoft.DataTransformationServices.Controls)
I also tried (DT_STR, 23, 1252) @[System::StartTime] and I get the following error
The expression " (DT_STR, 23, 1252) @[System::StartTime]" has a result type of "DT_STR", which cannot be converted to a supported type.
Any help?
View 3 Replies
ADVERTISEMENT
Jan 10, 2006
I have been trying to store some start times, System::StartTime, System::EventHandlerStartTime and the likes to get exact running times for packages and tasks. What I am beginning to believe is that the maximum resolution of these times are seconds. It could be an incredible coincidence, but when I store the following string in the database OnPreExecute: (DT_WSTR, 30)@[System::EventHandlerStartTime] + " " + (DT_WSTR, 30)GETDATE() I will get results like: 2006-01-10 10:58:38 2006-01-10 10:58:38.377000000. There are never any milliseconds shown for the EventHandlerStartTime. I am going use GETDATE() for now as a workaround, but I would prefer to use the exact start time. Any suggestions?
Regards,
Lars
View 1 Replies
View Related
Mar 29, 2006
This is a Subject Expression I put in my Mail component in my SSIS 2005 package but it's not liking the StartTime concatenation. I tried other ways but can't get it to allow this:
"Process Started by : " + @[System::UserName] + (DT_DATE) @[System::StartTime]
I get the error:
TITLE: Expression Builder
------------------------------
Expression cannot be evaluated.
------------------------------
ADDITIONAL INFORMATION:
The data types "DT_WSTR" and "DT_DATE" are incompatible for binary operator "+". The operand types could not be implicitly cast into compatible types for the operation. To perform this operation, one or both operands need to be explicitly cast with a cast operator.
Attempt to set the result type of binary operation ""Process Started by : " + @[System::UserName] + (DT_DATE)@[System::StartTime]" failed with error code 0xC0047080.
I tried to use CAST() but not sure if that's allowed or the syntax for it specifically in SSIS 2005
View 1 Replies
View Related
Oct 19, 2006
I am trying to put the data from a field in my database into a row in a table using the SQLDataSource.Select statement. I am using the following code: FileBase.SelectCommand = "SELECT Username FROM Files WHERE Filename = '" & myFileInfo.FullName & "'" myDataRow("Username") = CType(FileBase.Select(New DataSourceSelectArguments()), String)But when I run the code, I get the following error:Server Error in '/YorZap' Application. Unable to cast object of type 'System.Data.DataView' to type 'System.String'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.InvalidCastException: Unable to cast object of type 'System.Data.DataView' to type 'System.String'.Source Error: Line 54: FileBase.SelectCommand = "SELECT Username FROM Files WHERE Filename = '" & myFileInfo.FullName & "'"
Line 55: 'myDataRow("Username") = CType(FileBase.Select(New DataSourceSelectArguments).GetEnumerator.Current, String)
Line 56: myDataRow("Username") = CType(FileBase.Select(New DataSourceSelectArguments()), String)
Line 57:
Line 58: filesTable.Rows.Add(myDataRow)Source File: D:YorZapdir_list_sort.aspx Line: 56 Stack Trace: [InvalidCastException: Unable to cast object of type 'System.Data.DataView' to type 'System.String'.]
ASP.dir_list_sort_aspx.BindFileDataToGrid(String strSortField) in D:YorZapdir_list_sort.aspx:56
ASP.dir_list_sort_aspx.Page_Load(Object sender, EventArgs e) in D:YorZapdir_list_sort.aspx:7
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +13
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +45
System.Web.UI.Control.OnLoad(EventArgs e) +80
System.Web.UI.Control.LoadRecursive() +49
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3743
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.210 Please help me!
View 3 Replies
View Related
Mar 26, 2007
Hi,We have stored proc name proc_test(str nvarchar(30)). So far this prochas been invoked from a .NET application assuming that only Englishcharacter strings will be passed to it. The calls are likeproc_test('XYZ')We now have a requirement for passing Chinese strings as well. Ratherthan changing the calls throughout the application, we would like tohandle it in the stored procedure so that it treats the string as aunicode string. Can we apply some function to the parameter to convertit to unicode so that we don't have to call with an N prefixed to thestring?Thanks,Yash
View 1 Replies
View Related
Jun 19, 2008
I'm getting this error on a vb.net page the needs to execute two separate stored procedures. The first one, is the main insert, and returns the identity value for the ClientID. The second stored procedure inserts data, but needs to insert the ClientID returned in the first stored procedure. What am I doing wrong with including the identity value "ClientID" in the second stored procedure?
Unable to cast object of type 'System.String' to type 'System.Web.UI.WebControls.Parameter'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.InvalidCastException: Unable to cast object of type 'System.String' to type 'System.Web.UI.WebControls.Parameter'.Source Error:
Line 14: If li.Selected Then
Line 15: InsertClientCompanyType.InsertParameters("CompanyTypeID").DefaultValue = li.Value
Line 16: InsertClientCompanyType.InsertParameters("ClientID") = ViewState("ClientID")
Line 17:
Line 18:
Source File: C:InetpubwwwrootIntranetExternalAppsNewEmploymentClientNewClient.aspx.vb Line: 16
Here is my code behind... What am I doing wrong with grabbing the ClientID from the first stored procedure insert?
Protected Sub InsertNewClient_Inserted(ByVal sender As Object, ByVal e As SqlDataSourceStatusEventArgs)ClientID.Text = e.Command.Parameters("@ClientID").Value.ToString()ViewState("ClientID") = e.Command.Parameters("@ClientID").Value.ToString()End SubProtected Sub Submit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Submit.ClickInsertNewClient.Insert()For Each li As ListItem In CompanyTypeID.Items
If li.Selected ThenInsertClientCompanyType.InsertParameters("CompanyTypeID").DefaultValue = li.ValueInsertClientCompanyType.InsertParameters("ClientID") = ViewState("ClientID")InsertClientCompanyType.Insert()End IfNextEnd Sub
View 2 Replies
View Related
Aug 1, 2007
Hello,
I have a problem with the following task:
The user is prompted to specify a starttime like 02 and a endtime 04.
The user for example wants to search all events between 2 am and 10 am regardless of the date.
I use the following SQL ti filter:
Where (DATEPART(hour, Event.EventDateTime) BETWEEN @StartHour AND @EndHour)
This works fine as long starhour is smaller than endhour.
When i want to filter Events beteween 23 (11 pm.) and 02 (2 am) i get no results. I have to make a search possible for a time span that is over midnight.
Anyone who has some ideas?
Thank you i advance!
View 1 Replies
View Related
Dec 31, 2007
Hi, I got this field (dateSubmitted) having a data type of DateTime but I receive this error "Unable to cast object of type 'System.DateTime' to type 'System.String'." All value for dateSubmitted field are 12/27/2007 12:00:00 AM. cheers,imperialx
View 3 Replies
View Related
Nov 7, 2007
I have a fixed-width flat file that I'm importing to a SQL table in a data flow task. The first field is an ID field, of length 12, that I'm told I can assume is an INT datatype. Obviously, it's a little silly to shove an integer that can be a max of 10 digits into a 12 digit field... but that's my situation.
I set the columns on the flat file connection manager to be inputColumnWidth of 12, and datatype of DT_I4. When I try to run the package, I get the error (understandably): The data conversion for column "ID" returned status value 2 and status text "The value could not be converted because of a potential loss of data.".
What are my options here? I'm going to assume that even though the width is 12 characters, only an integer will appear in those spaces. I attempted to use a derived column and a type cast, but to no avail. Help would be appreciated... thanks!
View 5 Replies
View Related
Jun 27, 2006
is there a way to query a varbinary column and print the readable char in query analyzer?
thanks in advance!
Ryan
View 3 Replies
View Related
May 3, 2007
Hi guys,I'm currently trying to insert image into my SQL db.
I have tried a number of methods that were posted online, and so far
with no luck.My current code reads: Dim conn As New Data.SqlClient.SqlConnection() conn.ConnectionString = ConfigurationManager.ConnectionStrings("MainDBConnection").ToString conn.Open() Dim cmd As New Data.SqlClient.SqlCommand("SP_SAVEImage", conn) cmd.CommandType = Data.CommandType.StoredProcedure Dim sImageName As New Data.SqlClient.SqlParameter("@sImageName", Data.SqlDbType.VarChar, 50) sImageName.Value = sImageName Dim sImageType As New Data.SqlClient.SqlParameter("@sImageType", Data.SqlDbType.VarChar, 50) sImageType.Value = fileType Dim sImageData As New Data.SqlClient.SqlParameter("@sImageData", Data.SqlDbType.Image, uploadedFile.Length) sImageData.Value = uploadedFile cmd.Parameters.Add(sImageName) cmd.Parameters.Add(sImageType) cmd.Parameters.Add(sImageData) Dim reader1 As Data.SqlClient.SqlDataReader reader1 = cmd.ExecuteReaderRunning
through debug, everything runs up until the last line, where an error
is caught saying : Failed to convert parameter value from a
SqlParameter to a String I reckon it's to do with the input sImageData being input as a byte array - but I can't seem to find a way around it. Any help greatly appreciated!!
View 1 Replies
View Related
Apr 20, 2008
I have been working on this all day and cannot find an answer
I need to convert a string to an object, a string to object of type Command
Is there anyway to do this?
Thank you all in advance!!!!!!!
View 1 Replies
View Related
Jan 21, 2001
I am writing a stored procedure that generates a computername for new workstations. Our naming standards, based on terminal ID's, are as follows:
'R' + X + Y + ZZZ, where 'R' is the letter 'R', X is a hex digit indication a locatoin, Y is a hex digit indicating business line, and ZZZ is a hexadecimal sequential number assigned within each location/busines line, for up to 4096. (This isn't a perfect naming standard, but is an improvement over the one that preceded it and is a requirement for our legacy applications).
I can do everything fine, and calculate the sequential number using an int. Once I have the new number, I am trying to convert the integer to a varbinary, then convert that to a string, then use RIGHT to get the rightmost three characters of the hex string.
set @SEQNUM = 4095
set @HEXSEQNUM = CONVERT(varbinary ,@SEQNUM)
PRINT CONVERT(varbinary ,@SEQNUM) -- displays 0x00000FFE etc.
PRINT 'HEXSEQNUM ' + @HEXSEQNUM -- displays 'HEXSEQNUM'
Any ideas? I am very new to TSQL...
View 1 Replies
View Related
Aug 12, 2005
Hello,I try to convert a pseudo datetime string into a date. In Oracle I can doto_date( MyDate, 'yyyymmddhh24miss' ); how I can do this with MS SQL ?thanks and regardsMark
View 2 Replies
View Related
Aug 6, 2007
I get the following error when I do a CONVERT(UNIQUEIDENTIFIER, 'guid'), where 'guid' is a properly formatted GUID created in VS2005, inside my INSERT statement:
The data was truncated while converting from one data type to another. [ Name of function(if known) = ]
The column I am inserting into has a datatype of uniqueIdentifier.
This is the query I am running:
INSERT INTO [Table] ([guid], [value1], [value2])
VALUES (CONVERT(UNIQUEIDENTIFIER, 'F067FE20-EC76-44C8-9859-FEF222FBC96D'), 'Test, 'Test')
What am I doing wrong?
Matt
View 3 Replies
View Related
Jul 26, 2007
Hi
What's wrong about
SELECT SUM(CASE WHEN [PO Date] BETWEEN CONVERT(Datetime, @FY + '/04/01')
AND CONVERT(Datetime, @FY -1 + '/03/31') THEN Quantity ELSE 0 END) AS Expr1,
[Item No_]
FROM table A
View 7 Replies
View Related
Jul 18, 2006
I am trying to write a function to convert a hex string to binary. I would like it in a function so I can use it on aggregate data in queries (instead of having to cursor through the data). So, I write my function:
CREATE FUNCTION HexToBinary (@hexstring char(16)) RETURNS binary(8)
AS
BEGIN
declare @b binary(8)
,@sql nvarchar(255)
SET @sql = N'SET @b = 0x' + @hexstring
EXEC sp_executesql @sql,N'@b binary(8) out',@b output
RETURN @b
END
Then, I try to call my function:
SELECT HexToBinary('E0')
...and I get:
Msg 195, Level 15, State 10, Line 1
'HexToBinary' is not a recognized built-in function name.
However, I can get it to work if I use a slightly different syntax:
declare @b binary(8)
exec @b = HexToBinary 'E0'
select @bAny thoughts as to what might be going on? Obviously, the lower syntax does not help me call this function in queries, which is really my goal.
View 6 Replies
View Related
Nov 19, 2006
Hi, I need to convert the values entered into textboxes by the users before I can insert into db.have tried the following. Dim eventnum As string 'tried using integer makes no difference what i declare the variable aseventnum = Convert.ToInt32(txteventnum.Text)This value needs to be inserted into the field event_number wich is datatype int I get the following error message when I try to insert. Conversion failed when converting the varchar value 'eventnum' to data type int.
Description: An
unhandled exception occurred during the execution of the current web
request. Please review the stack trace for more information about the
error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Conversion failed when converting the varchar value 'eventnum' to data type int.
Source Error:
Line 62: Line 63: ' Execute(query)Line 64: myCommand.ExecuteNonQuery()Line 65: Line 66: 'Close the connection
Source File: C:InetpubloansMemberPagesRequest.aspx.vb Line: 64
Stack Trace:
[SqlException (0x80131904): Conversion failed when converting the varchar value 'eventnum' to data type int.] System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +857242 System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +734854 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +188 System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1838 System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async) +192 System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) +380 System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +135 Request.Button1_Click(Object sender, EventArgs e) in C:InetpubloansMemberPagesRequest.aspx.vb:64 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102
View 4 Replies
View Related
Mar 31, 2008
Hi Gurus,
Here is my problem-:
I have a field in the SQL 2005 database with type varbinary(50). Now when i enter value to this field, I enter a value for example 111111101. The reason to enter such a value in varbinary(50) type is, that this value is meant to grow, as each 1 and 0 in this value is a permission or right my user would have to various features of the web application, I am designing. Now when I open the table to see the data in the database, it shows as <Binary data>. But that's okay, as binary fields are mostly meant to store pictures, files etc. But when I read this value into my ASP.Net code using c#, the value as returned as 069F6BBD. After some research I realized that for decimal value 111111101, the hex value is 069F6BBD.
All I need in my code is the same thing that I entered which is 111111101.
Can someone guide me a lil bit.
Thanks in advance..
VJ
View 7 Replies
View Related
Jun 6, 2008
I have a dropdown list thats boudn to a SqlDataSource. The DataSource looks like this:
<asp:SqlDataSource ID="dsProgramList" runat="server" ConnectionString="<%$ ConnectionStrings:csData %>"
SelectCommand="SELECT DISTINCT [Program_Name] +','+ [Begin_Date] AS NAMEandDATE, [Course_ID], [LOC] FROM [ThisTable] WHERE ([LOC] = @LOC)">
<SelectParameters>
Where the dropdownlists text = NAMEandDATE and its value = Course_ID
When I select the LOC from the LOCdropdownlist, the dropdownlist in question updates, and an error "Erro converting datetime from character string" happens?
Any suggestions?
View 4 Replies
View Related
Jun 28, 2004
Hi there,
I have the following code:
Dim CityTown As String = Ctype(Request.Querystring("CityTown"), String)
Dim Suburb As String = Ctype(Request.Querystring("Suburb"), String)
Dim SuburbValue As String = Ctype(Request.Querystring("Suburb"), String)
Dim Rooms As String = Ctype(Request.Querystring("Rooms"), String)
Dim Rent As String = Ctype(Request.Querystring("Rent"), String)
Dim DateToday = DateTime.Now
Dim mySQL AS String
If suburbValue = "- All -" Then
mySQL = "SELECT propListID, propListExpires, propBuildType, propRoomNumber, propRentPerWeek, propDescription, propCityTown, propSuburb FROM tblPropertyList WHERE [propCityTown]='" & CityTown & "' AND [propRentPerWeek]<= '" & Rent & "' AND [propRoomNumber]='" & Rooms & "'AND [propListExpires] >='" & DateToday & "' "
However I am having trouble getting the Date to work as part of my SQL String. I keep getting the following error:
Syntax error converting datetime from character string.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Syntax error converting datetime from character string.
Source Error:
Line 30: MyDA = New SqlDataAdapter (mySQL, myConn)
Line 31: myDS = New DataSet()
Line 32: myDA.Fill(MyDS)
Line 33:
Line 34: dlPropertyListing.Datasource = MyDS.Tables(0)
Source File: K:detailsdetailspropertylisting.aspx Line: 32
Any ideas how to resolve this?? I do not want to use Parameters in my statement.
Thanks in advance,
TCM
View 3 Replies
View Related
Jul 9, 2007
Hi all, first time post so go easy.
I have been trying to find a way of creating a datetime comprised of getdate() and a time that i specify. I am trying to do this as shown below:
Declare @Test datetime
Declare @Test1 Datetime
Set @Test = getdate()
SET @Test1 = CONVERT(datetime, datepart(y, @Test) + datepart(m, @Test)+ datepart(d, @Test)+' 16:30:00',120)
So, i am building a string using datepart and then adding the time at the end. The 120 after the final comma is to define the style (as i am sure you will all know anyway).
When i run this i get the following error:
Msg 245, Level 16, State 1, Line 35
Syntax error converting the varchar value ' 16:30:00' to a column of data type int.
If i take out the colons it runs but brings back the wrong date, the whole date seems to be dependant on the time part at the end.
I am sure this is a really simple problem and i am sorry if i am wasting you time but its late and i just cant see it. Any help would be fantastic.
View 2 Replies
View Related
Dec 2, 2004
Can anyone tell me what this error message means and how I can correct it on my statement:
Code:
Server: Msg 241, Level 16, State 1, Line 1Syntax error converting datetime from character string.
Here's my query statement:
Code:
SELECT animalid AS "Animal ID", name AS "Name", categoryid AS "Category ID", DATENAME(MONTH, dateBorn) + ' ' + DATENAME(DAY, dateBorn) + ', ' + DATENAME(YEAR, dateBorn) AS "Date of Birth"FROM animalWHERE categoryid = 'Cat' AND dateBorn = 'May%'
I know it has something to do with: dateBorn = 'May%' because when I took out Quote: AND dateBorn = 'May%' I get results, but I need to narrow it down to list the cats born in May.
View 6 Replies
View Related
Nov 23, 2005
I'm looking for some good hints and tips for reprogrammin an old VB module I just found.
Basically what it does, is receive an input parameter (an int), does a select [name row] from Names where Name_id = [input parameter] and turns this into a string if multiplenames appear.
E.g. result set: John, Josh, Jock turns it into string "John Josh Jock".
So its piece of cake creating a stored procedure selecting data on the base of an input parameter. Select X from Y where Z = @input... the trick is, I don't know how to do arrays in TSQL as in VB.
In the VB edition I create an array, load the names into it, I do a count on how many row the select returns and then a simple for... next adding the names to the string.
Any good examples on how to do this in a sql-server stored proc?
Thanks,
Trin
P.S. This is what I have pieced together this far:
CREATE PROCEDURE findnames
@number int
AS
DECLARE @instrument varchar(50)
DECLARE @tempinstt varchar(10)
DECLARE medlemcursor CURSOR
FOR
SELECT [MCPS Kode]
FROM DW.dbo.names(NOLOCK)
WHERE number = @number
OPEN medlemcursor
FETCH NEXT FROM medlemcursor INTO @tempinstt
WHILE (@@FETCH_STATUS <> -1)
BEGIN
SET @instrument = @instrument + @tempinstt + '-'
FETCH NEXT FROM medlemcursor INTO @tempinstt
END
CLOSE medlemcursor
DEALLOCATE medlemcursor
SELECT @instrument
GO
Just doesn't seem to work, returns NULL, even though I've checked that the cursor SELECT statement actually returns data,
View 5 Replies
View Related
Jul 19, 2014
I have a column which has 05MAY2006:04:34:00.000000 it is stored as varchar(25). I need to save it as datetime in the same column. I have tried using
update tablename
set columnname = (SUBSTRING(columnname,1,2) + '-' + SUBSTRING(columnname,3,3) + '-' +
SUBSTRING(columnname,6,4) + ' ' + SUBSTRING(columnname,11,8));
and then
alter table tablename
alter columnname datetime;
but later it shows up the error
Msg 242, Level 16, State 3, Line 1
The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.
How do I change it any other opinion or any modification for the above query.
View 2 Replies
View Related
May 5, 2008
Hi
there is something strange in the code below:
declare @a money
set @a=1.2365
print cast(@a as varchar(10))
when i run the code in the query analizer , the output will be rounded and always will be displayed with two decimal digits(=1.24)...why?
how can i move the whole number value as an string value to an string variable without this truncation?
Thanks.
kind Regards.
View 3 Replies
View Related
Jun 12, 2008
I am trying to import a txt file that has a string for it's date. How do I change it over in the import wizard I've tried going to advance then changing from string to date or date time but I get an error.
View 14 Replies
View Related
Sep 19, 2014
I have a string like below
DECLARE @STR VARCHAR(100) = 'AAAAAA~KKKKK~LLLL~AAAA'
i want to convert the string into rows like
AAAAAA
KKKKK
LLLL
AAAA
View 2 Replies
View Related
Jan 29, 2007
I am very new to SSIS though I have written hundreds of SQL 2000 dts' with all kinds of active scripts doing all kinds of things. I am now trying to convert them to SSIS and since scripts don't come through the migrator I am doing them by hand once again. I have the package created, but one of the input fields on the text file is YYYYMMDD , but the database field it is going into is a datetime so I need to convert it to a valid date format so that the conversion will take place. I tried data conversion task but that doesn't work, now I'm assuming I need to use the derived column, but not sure and don't have a clue how to use that, can anyone help? Thanks bostonrose
View 2 Replies
View Related
Mar 20, 2007
Stuart writes "Hi being new to this game
I have have an error when trying to inseet string into a table with datetime field.
the date is not that important its the time that I use in later steps
I am creating a global temp table and then inserting values into it
below is the code
-- create the temp table
Execute ( 'create table ##progsch0
([Time] [DateTime] , '
+ '[' + @day7 + '] [varchar](100) ,'
+ '[' + @day1 + '] [varchar](100) ,'
+ '[' + @day2 + '] [varchar](100) ,'
+ '[' + @day3 + '] [varchar](100) ,'
+ '[' + @day4 + '] [varchar](100) ,'
+ '[' + @day5 + '] [varchar](100) ,'
+ '[' + @day6 + '] [varchar](100) )')
set @Starttime = 'JUL 21,2006 5:30am'
I am doing the insert in this manor becuase the @Starttime
in code actually changes time and a new record in inserted into the temp table.
Set @SQL = 'Insert into ##progsch0 (Time)
Values(convert(varchar,Convert(datetime,'+ @Starttime +'),100))'
PRINT @SQL
execute sp_executesql @SQL
I may to doing this in the completely wrong manor.
Any help would be greatful "
View 1 Replies
View Related
Aug 14, 2007
I am trying to select all members from a SQL db who have a renewal date btw to dates inputted into two text fields, but I am now getting the error above. This is where the problem is coming in...
If strStartDate <> "" and strEndDate <> "" Then
If bParam = True Then
StrSQL = strSQL & " AND "
Else
StrSQL = strSQL & " WHERE deleted=0 AND "
End If
strSQL = strSQL & "renewal_due BETWEEN '%" & Replace(strStartDate,"'","''") & "%' AND '%" & Replace(strEndDate,"'","''") & "%' "
End If
Any help would be greatly appreciated!
Thank you...
View 7 Replies
View Related
Sep 24, 2007
Hello all,
New to the forums here. I'm not a beginner with SQL, but nor am I a SQL developer - network engineer who knows some scripting and the fundamentals of DB design/administration. There's the background.
I have a database of client information where a date is keyed in and stored as text. Because this is entered by end-users, the way it's entered varies - 1/1/2001, 01/01/2001, etc. Most use "1/1/2001" (note the date is not the same for each record)
I have 4,000 records to update and I need to try to convert the text string to the correct date - changing 1/1/2005 to the same date in proper date/time format. My database uses datetime as an integer calculating the number of days from 12/30/1800. Today's date would be 75508. Time is separated into different fields.
I can do the work to update the text to a single format to make the conversion easier, but I am having trouble locating the proper way to write a convert function to do this. I've searched online (which is how I came here) and have searched the forums without luck.
Any help would be greatly appreciated!!!
View 6 Replies
View Related
Jul 23, 2005
I try to accomplish the following:I have two tables which are connected via a third table (N:Nrelationship):Table 1 "Locations"LocationID (Primary Key)Table 2 "Specialists"SpecialistID (Primary Key)Name (varchar)Table 3 "SpecialistLocations"SpecialistID (Foreign Key)LocationID (Foreign Key)(both together are the primary key for this table)Issuing the following commandSELECTL.LocationID , S.[Name]FROMLocations AS LLEFT JOIN SpecialistLocations AS SL ON P.PlaceID = SL.LocationIDLEFT JOIN Specialists AS S ON SL.SpecialistID = S.SpecialistIDresults in the following table:LocationID | Name1Specialist 11Specialist 22Specialist 32Specialist 43Specialist 14Specialist 4Now my problem: I would like to have the following output:LocationID | Names1Specialist 1, Specialist 22Specialist 3, Specialist 43Specialist 14Specialist 4....which is grouping by LocationID and concatenating the specialistnames.Any idea on how to do this?Thank you very much,Dennis
View 5 Replies
View Related