Hate to sound so dumb, but, it's been years since I've done any SQL programming and I was bad at the time!
What is the code for taking my time stamp 2007-02-09 10:15:02.000 and just displaying the date as 02/09/2007?
Do I use variables? Are they set up before my select statement? Can anyone suggest a really good, easy, very explanable SQL (that will work in SQL Server) progamming book?
I am populating oracle source in Sql Server Destination. after few rows it fails it displays this error:
[OLE DB Destination [16]] Error: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005. An OLE DB record is available. Source: "Microsoft OLE DB Provider for SQL Server" Hresult: 0x80004005 Description: "Invalid date format".
I used this script component using the following code in between the adapters, However after 9,500 rows it failed again giving the same above error:
To convert Oracle timestamp to Sql Server timestamp
If Row.CALCULATEDETADATECUST_IsNull = False Then
If IsDate(DateSerial(Row.CALCULATEDETADATECUST.Year, Row.CALCULATEDETADATECUST.Month, Row.CALCULATEDETADATECUST.Day)) Then
dt = Row.CALCULATEDETADATECUST
Row.CALCULATEDETADATECUSTD = dt
End If
End If
I don't know if my code is right . Please inform, how i can achieve this.
i am creating a DTS package that will query a table and move data to another table daily on same DB/SERVER. i want to be able to timestamp previous date into date column in destination table. There's no date on source but i need timestamp on each import and date for previous day b/c importing data are for previous day.
I'm having trouble importing data with a binary timestamp. I have a group of datafiles with various data types mixed in and I seem to get a lot of errors during the import attemt using BCP.. The timestamp data is represented in the text file to be imported as 0x0000aedc (Hexidecimal representation of timestamp) I'm using the tilde (~) as a delimiter. What can I do to get past this rather annoying problem? Datetime seems to be accepted fine if I use char as the import datatype and 26 as the length. It seems to swallow that fine. It seems to be the timestamp field I'm tripping on. Timestamp comes up as [binary] Prefix length = 2 Field terminator = ~
I have a problem with an Order By sort on a SubmissionDate column in my SQLSERVER DB.
I am inputing a timestamp in this format into the column above: 1/18/2005 11:03:19 AM
Problem is, once I sort this column in DESC order to return the results to a datalist dates with a time like this:
1/18/2005 1:03:19 AM
get placed out of place (lower on the return in DESC/higher on the return in ASC). I am assuming this is happening because it reads 1 as coming before 11 instead of after like it is with time. If this was in 24 hour format this wouldn't be a problem I guess because 1PM would be 13, so that is after 11.
Anyone know what I can do to get this sorted correctly?
I am pulling files from the FTP site using the FTP task. I want to also capture the date and timestamp of each of these files so that I can insert the values into a database and track when are these files get created normally on the FTP server.
I have a set of data with epoch timestamps. Purely for the sake of reporting, I need to pull the last six months of data and group it by month. I have tried searching the googles for epoch/milliseconds to datetime but I only get the MySQL or Oracle results, not MSSQL.
SELECT '1' AS Join_Field, T1.ID AS T1_ID, T2.ID AS T2_ID, T1.TimeStamp AS T1_Timestamp, T2.TimeStamp AS T2_Timestamp, DATEDIFF(Minute, T1.TimeStamp, T2.TimeStamp) AS Difference_Mins, T1.eventid, T1.shiftID, T1.Value, SD.Shift_Start_Date, T1.StopCode, T1.Status, T1.JobID, T1.StatusDesc, T1.StopDesc, T1.MachineID, CAST(CASE WHEN CONVERT(date, T1.TimeStamp, 103) < CONVERT(date, SD.Shift_Start_Date, 103) THEN 1 ELSE 0 END AS int) AS flag, CAST(T1.TimeStamp as DATE) AS TS_Date FROM PolReporting.Event_M2_T1 AS T1 INNER JOIN PolReporting.Event_M2_T2 AS T2 ON T1.RowID = T2.RowID INNER JOIN Intouch.ShiftDates_Grouped AS SD ON T1.shiftID = SD.ShiftID
I know 2008 MS SQL Server has a timestamp data type that adds date and time when the rows are inserted. Is there a way to automatically update the date and time when the rows are updated?
I have two fields DSRHADTI which is an isodate and DSRHTIME which is 8 char time field in format 10.31.00. I want to take both these fields and put them into a field that is database timestamp so I have converted DSRHDATI to 10 character field. I am then trying to use substring to put both into 18 character field using derived column transformation editor. but it does not like the below. It's red syntax error what am I missing.
(SUBSTRING(Copy of DSRHDATI,1,4) +' /' + SUBSTRING( Copy of DSRHDATI,6,2) + '/ ' + SUBSTRING(Copy of DSRHDATI,9,2)) + SUBSTRING(DSRHTIME,1,2) + '.' + SUBSTRING(DSRHTIME,4,2) + '.' + SUBSTRING(DSRHTIME,7,2)
One I get the above to work I plan on convert 18 char to datetimestamp.
Is there a way to extract the date part (11/27/2012) of a datetime/time stamp column (11/27/2012 00:00:00.000) and keep it in a date format?
The code i have below extracts the date part of a timestamp column and converts it to a char field. This becomes a problem when I joing the resultant table with a SAS dataset which contains the same column but is in a date format. The join process generates an error saying the column is in different formats.
I have a simple package to load data from sql server db into a flat file. I have a date field in the source data base (data type DATETIME) when i open the csv file some show the exact time stamp and some records show just the seconds like (00:00:0.7). I used CAST CONVERT bu still the same issue.
Hey guys, I'm new to reporting services and I just need to throw together a report that references multiple datasources. I can query up all my info individually, but I need to write a query that says,
Select ProductName,ProductId from datasource 2
where ProductId = @ProductIdFromDataSource1
I can get this to work, but if my query from datasource 1 returns 10 productID's, this will only return the productname from the first ProductID, 10 times. I believe that's because I'm using the First() aggregate function. Is there another function I can use that doesn't do that, or some way I can reference each field individually?
Just to clarify a little more, here's what I want:
Hello there, i'm pretty new to web development and i've come across this problem, so here's the case.I got a videoclub database and i wanna show the movies categorized by the category that the movie belongs to. I got a table with all the categories (the table includes an ID and the name of the category),and the movies table has movie data plus a category id field which is related with the categories table. Anyway enough with the background info here's the query i'm trying to use:SELECT MovieID, Name, Director, Category, Casting, Photo, Supplier, ReleaseDateFROM MoviesWHERE (Category = @ Category) The error i'm getting on the query builder is "Error in WHERE clause near '@'. Unable to parse query text.". If i aint wrong i'm supposed to use the "@" to indicate that its supposed to get data from a control. Anyway thats the prob, any help would be really apreciated.P.S. The control i'm using is a dropdownlist that shows the categories names and has as a value the category id, so there isn't a variable miss match error as much as i know.
Hi, I changed the sa password today on my subscriber databases, and now my transactional replication fails, as it cannot connect to the subscribers. I updated the publisher's linked server logins, but it still fails. Help please! Thanks, Jason
Hi, I am getting many instances of the following error, and I cannot find any documention on it, or how to remedy. Any help/suggestions would be GREATLY appreciated. Thanks in advance - jason
SQL Server Assertion: File: <xcbmgr.cpp>, line=1299 Failed Assertion = 'pss->IsXcbLocked ()'. Dump thread - spid = 58, PSS = 0x2e637158, EC = 0x2e637308 Stack Dump being sent to C:MSSQL7logSQL00115.dmp ************************************************** ***************************** * * BEGIN STACK DUMP: * 10/04/00 16:39:54 spid 58 * * Input Buffer 42 bytes - * s e l e c t u i d = N E W I D ( ) * ************************************************** *****************************
I know that the query governor works off of estimated query plans, but the estimation is usually so far off from reality that it might as be generating a random number to determine whether a query should run.
Right now I have query governor set at 300. I've been able to run queries that take more than 10 minutes without any complaint from query governor.
What's really annoying though, is that it has also blocked queries that take less than a second to run. It blocked a query for having an estimated executing time of 338 seconds. When I set the limit up to 400, the query ran virtually instantly.
Is this just how query governor is suppose to work? Is there any way to make it work better?
Can someone help me rewrite this query? Basically I need to check if the name stored in "CustomerName" already exist in the table "Renter". If it does not then I ncan insert the new customer name into the data table "Renter". If the value in "CustomerName" already exists in the database, then I need to bypass the "INSERT" and somehow return a value indicating that the insert was not performed. How can I do this. Here is the query I currently have for performing the insert. CREATE PROCEDURE [dbo].[VacancyGet] ( @CustomerName nvarchar(100), @ClientCode nvarchar(10) ) AS INSERT INTO Renter ( CustomerName, ClientCode, ) VALUES ( @CustomerName, @ClientCode, )
For starters, please feel free to move this if it is in the wrong forum.
The issue I have is this. I have been asked to delete all information from a table that was inserted before May 12 this year. The issue is that when the DB was created, whoever designedd it neglected to add a timestamp column for the user data table (the one I need to purge). Does SQL, by default, happen to store insert times? Would it be something that might hide ina log file somewhere?
I have a timestamp in a date field of a table I have but when run it does not enter the date automatically and all I get is system.byte[] display where the dtae and time should be, how can i get it so this field places the date in automatically.???
I am retrieving data from a database, and have been noticing some really strange timestamps. Has anyone ever seen a timestamp that looks like this: 16777215Karls
I just started using SQL and i don't really know too much syntax.
I have an ASP page that is inserting data into a table called YellowAlerts. The first field in this table is AlertDate. I thought I read somewhere that there is a timestamp feature. If anyone could help me out that would be great.
I believe that all created tables have got by default a timestamp field. I tried to find out how to read this field with a Transact-SQL statement. And so I don't know the syntax, is anyone can help me ?
If i have a table with a 3 fields and one of them has a timestamp as a field type and I want to do an insert or update what is the value I am inserting for the column timestamp.