How can I find the timezone of a SQL Server database? [closed] - sql

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
Is there an easy way to find the timezone for datetime dataype of SQL Server database?

You can use SYSDATETIMEOFFSET(). This will tell you the offset from GMT at the end.
SELECT SYSDATETIMEOFFSET()
2016-06-21 08:36:54.9753055 -04:00

Try this.
DECLARE #TimeZone VARCHAR(50)
EXEC MASTER.dbo.xp_regread 'HKEY_LOCAL_MACHINE',
'SYSTEM\CurrentControlSet\Control\TimeZoneInformation',
'TimeZoneKeyName',#TimeZone OUT
SELECT #TimeZone

Related

How can I get the table name in a SQL Server trigger function? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I tried to get the table name in a SQL Server trigger function but I can't.
Please help me.
Try this query for get the table name using trigger function:
#tablename = OBJECT_NAME(parent_object_id)
FROM sys.objects
WHERE sys.objects.name = OBJECT_NAME(##PROCID)**

What is a clean way to copy a SQL table with more than 1000 rows? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 3 years ago.
Improve this question
I know the question "How to copy table with more than 1000 rows" is already asked. I have read a lot about it and the different solutions like:
use export to excel and than import in new table
use UNION ALL (but not recommend)
use bulkreader
export to file and import
etc.
All the solutions sounding like a workaround. I am asking myself, is there no "official", clean way to do it?
Thank you.
Edit:
SELECT INTO was tried
INSERT INTO was tried
Using sql MS MGM studio
using HeidiSQL
Working on a MS SQL Server 13.0.4001.0
The cleanest and fastest solution with T-SQL would be into:
select *
into [destination table]
from [source table]
This will copy your data into a [destination table]. Be mindful of the remarks and limitations in the documentation regarding this keyword.

How to use sp_depends for other database [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
Using SQL Server 2010
For updating the tables i am using following line
update database1_ab..table1
For sp_depends i am getting error as "Incorrect syntax near '.'"
sp_depends database1_ab..table1
How to use sp_depends for referring other database tables in current database
regardless, you need to put it in single quotes... ie
sp_depends 'database1_ab..table1'
or
sp_depends '[database1_ab]..[table1]'
You can call all the sp_ -procedures also in different database like this:
database1_ab..sp_depends table1

Alter script not working on server [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I have an alter script to change datatype from nvarchar to float which works fine in my local machine but fails to work on 2012 server.
Can anybody tell me what's wrong with my script or any changes need to be done on server?
My alter script is as follows:
ALTER TABLE mytable
ALTER COLUMN mycolumn FLOAT
and I get this error:
Msg 8114, level 16,state 5, line 6
Error converting datatype nvarchar to float
If it is throwing an error 'Error converting data type varchar to float.' then it is obvious that there are some values in the varchar field which cannot be converted to float. If you can tell us more about the error being thrown, it will be easier to understand the issue.

SQL Fiddle - date format not recognized [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 9 years ago.
Improve this question
So as someone advised me yesterday I'm using SQL Fiddle since it's an easy way to test database queries and SQL programming in general but I'm getting this error:
Schema Creation Failed: ORA-01821: date format not recognized
This happens in the insert line. This usually works in Oracle and I selected in the combobox on top of the page Oracle 11g. So what's the problem?
create table Reparacoes(
numero_r int,
matricula char(8),
dataEntrada date,
constraint pk_carro primary key(numero_R),
constraint check_matricula check (regexp_like(matricula,'[[:number:]]{2}-[[:alpha:]]{2}-[[:number:]]{2}')));
insert into Reparacoes values (1,'S2-SS-12',to_date('yyyy-mm-dd','2013-11-10'));
By my own stupidity I was using the to_date wrongly. It's supposed to be like this:
to_date('2013-11-10','yyyy-mm-dd'));
and not like this:
to_date('yyyy-mm-dd','2013-11-10'));