vb.net, sql server, datetime format, select - sql-server

I am using vb.net to load data from SQL Server. I have table for inks and I have another table for tracking the employees been consuming these inks. I have VB.NET form with Datetimepicker control. The date time in SQL server is saved in the format yyyy-mm-dd 00:00:00.000 and the format in Datetimepicker is yyyy-mm-dd 00:00:00.000. When I load the data from the SQL server to my Datagrid in VB.NET I do not get the right data. Would someone please make clear about the Datetime format so I get the right data?
Thanks

Related

Store date in dd-mm-yyyy format or dd.mm.yyyy format in SQL Server (AWS RDS Distribution)

I'm migrating data from DB2 for Z/os (Mainframe) to RDS distribution of SQL Server.
In the mainframe, the date is stored in EURO format which is DD.MM.YYYY, when I migrate the data to SQL Server, the data is stored in SQL Server in YYYY-MM-DD ISO format.
All of my application program expects the date to be in DD.YY.MMMM format. I know I can use convert function at application programs to format the date to convert to EURO format. There are thousands of programs which would require change if I take that route.
Is there a way I can enforce SQL Server to store the date in DD.MM.YYYY or DD/MM/YYYY format ?
I already tried changing the Default Language of SQL server to "British English" it doesn't seem to be of any help. When I issue "DBCC USEROPTIONS" it shows Language as "BRITISH" and Date as 'dmy' but still when application program retrieves the date it's in yyyy-mm-dd format only.
My application program connects to SQL Server via ODBC driver and I have tried changing the OS Date from Control panel as well of dd/mm/yyyy format. Any advice on this issue will be of great help.
Thanks in advance!
I already tried changing the Default Language of SQL server to "British English" it doesn't seem to be of any help. When I issue "DBCC USEROPTIONS" it shows Language as "BRITISH" and Date as 'dmy' but still when application program retrieves the date it's in yyyy-mm-dd format only.
If you want to guarantee that that dates are returned as dd.mm.yyyy, then you can convert them to a string:
select convert(char(10), datecol, 104)
In SQL Server, you can handle this by using views or adding computed columns to the tables:
alter table d add datecol_ddmmyyyy as ( convert(char(10), datecol, 104) );
Otherwise, the application should be able to ingest SQL Server dates in the native format. This is only relevant if they are being converted to strings.

SSIS Sql Server to Oracle datetime component

We are migrating SQL Server system into Oracle implementation.
The application design date type:
SQL Server is achieved with DATETIME datatype EMPLOYEE(EMPLOYEE_HIRED DATETIME). Some of the columns contains time component as well till seconds.
Oracle is achieved with DATE datatype EMPLOYEE(EMPLOYEE_HIRED DATE). As we know, oracle date can hold time component as well
While migrating data from SQL Server to Oracle using SSIS, The system is defaulting it to TIMESTAMP datatype of oracle. Can this be defaulted to DATE?
There are around 1000+ such columns.
Do we need to address them manually through data conversion tool box? Can this be automated?

Oracle to SQL server Migration Date Format changes

I Used SELECT TO_CHAR(sysDate,'dy') FROM DUAL In oracle and I want to get the same output in SQL Server. I tried several ways and I want to know the date style value for this format.
CONVERT(VARCHAR(max),'2017-03-06T00:00:00.000',<DateStyle>)

SSAS OLAP Cube Output Date Format mm/dd/yy to yyyy-MM-dd

I have deployed an SQL Server 2012 on a Windows Server en-us.
Now my dates on Analysis services are in this format MM/dd/yyyy. the company is not American, therefore I would like to change it to yyyy-MM-dd.
Everything seems to be properly configured, however, SSAS is refusing to output the dates in the desired format.
Query on SQL Database engine
Windows Server Regional Settings
an easy and fast way is to create a computed column on DimDate in SSMS, and specify this a name value for your datekey. Let me if that works.
ALTER TABLE [Dim].[Date] ADD AlternateDateFormat AS convert(date,[FullDate], 111);

SSRS datetime filed is not refreshed event after the data type in SQL Db was changed from DateTime to Date

In my SSRS 2014 Express report designer I am displaying a field that had the datatype as DateTime in SQL Server and was displaying the data as, for example, 2011-12-31 00:00:00.000. As a result, the SSRS report was displaying the data as 11/31/2012 12:00:00 AM. I therefore, changed the datatype in SQL Db from DateTime to Date. Now this column in SQL query designer correctly display the value as 11/31/2012 but in the SSRS report the value is still displayed as 11/31/2012 12:00:00 AM. I've refreshed the fields in the data set.
I've checked that the data source is correct. I do know that we can change the date format of the datetime field item in the report designer using for example =FORMAT(Fields!SellStartDate.Value, "dd/MM/yyyy"). But I would like to have this change come directly from the data source so we don't have keep using expressions everywhere for the datetime fields. Also, I think it's better performance wise if the data is already formatted in the data source.
To refresh the field collection in the Report Data Pane for a shared dataset
In the Report Data pane, right-click the dataset, and then click Query.
Click Refresh Fields.
On the report server, the shared dataset query runs and returns the current field collection and any data type changes. If you change anything on the DB that can effect your query or dataset, you must refresh the metadata.
Hope this helps!
If you are viewing your report in the report builder - it might be cached. Therefore any changes to the Database side doesn't reflect on the report.
To resolve this close your report builder and find the directory where your RDL is stored and delete the .dat file which gets created along with it. Restart report builder and reload the report. It should work.
Good luck 1

Resources