|
hi,
i answer myself because i found the solution:
with sql server native client 10 we can't add param with subquery
but this problem is resolved with SQL native client 11 (sql server 2012)
thank you
|
|
|
|
|
hi i found a Gregorian date conversion function in sql server but i dont know how i can use it!
could you help me?
|
|
|
|
|
Not without seeing it.
What are you trying to achieve? All date/datetime types in MSSQL already use the Gregorian calendar. Are you trying to convert to a Julian date? A different calendar system?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
i wanna convert english calender to persian calender.i got this function but i cant use it.I am not a professional i MSSQL
|
|
|
|
|
Just put it back where you found it.
You'll never get very far if all you do is follow instructions.
|
|
|
|
|
thank you for your help
|
|
|
|
|
Perhaps you actually think of a function for converting from/to Persian calendar?
|
|
|
|
|
yeah i think about it and i dont know how i can use this.
|
|
|
|
|
Seems to be a solved problem, have some google foo[^]
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I ran this in the Management Studio:
update [Master] set Data_Thru = '7/23/2014 9:49:00 AM'
where Data_Thru = '7/23/2014 8:00:00 AM'
So why did it actually set the smalldatetime to 7/23/2014 9:50:00 AM?
(And don't yell at me for the table name. It wasn't my idea.)
|
|
|
|
|
Are you absolutely sure that that's the precise query that you executed, and that the row you're looking at is the one it updated?
smalldatetime[^] will round to the nearest minute, but it will only round up if the seconds are greater than or equal to 29.999; anything else will round down.
SELECT
CAST('7/23/2014 9:49:29.998 AM' as smalldatetime),
CAST('7/23/2014 9:49:29.999 AM' as smalldatetime)
;
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Richard Deeming wrote: Are you absolutely sure that that's the precise query that you executed, and
that the row you're looking at is the one it updated?
Yep.
Freaked me out. I've never seen that before, and it had no problem with me going in and correcting it back down to 9:49 via T-Sql
|
|
|
|
|
Weird. Are there any triggers on that table? Or other users updating the same row at the same time?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Nope. No triggers. And no users at all (yet).
Maybe we'll have to pass it off as a cosmic ray hitting the server and flipping a bit at just the right time. I see no resason for it, and Google came up with nothing, either.
|
|
|
|
|
When I run into impossible situations in code then the only solution is to examine my assumptions. That is always where I find the problem that lead to the impossibility in the first place.
|
|
|
|
|
What's the version / localization of your SQL Server?
I tried it with SQL Server 10.0.5500, German localized Management studio. I adjusted the date format of your query, and tested it. And it worked as it was expected to work - I cannot reproduce your bug.
|
|
|
|
|
10.50.1617.0 Management studio hitting 2008 R2 10.0.5500.0
I think it was a one-time glitch. I hate those.
|
|
|
|
|
Hi,
I have first_name, middle_name and last_name in my customers table.
I want to do
SELECT CONCAT(first_name, ' ', middle_name, ' ', last_name)
The middle name is optional
so I want to ignore it if it's blank to be:
SELECT CONCAT(first_name, ' ', last_name)
because if I do it the normal way I'll have extra space between the first_name and last_name
Technology News @ www.JassimRahma.com
|
|
|
|
|
You can use ISNULL on the first middle name or a case statement.
Case statement is more robust as it caters for ''.
Never underestimate the power of human stupidity
RAH
modified 20-Jul-14 22:36pm.
|
|
|
|
|
As long as you're doing it that way, you might as well use REPLACE.
You'll never get very far if all you do is follow instructions.
|
|
|
|
|
Without using CONCAT you can do this:
rtrim(isnull(first_name,'',first_name+' ') + isnull(middle_name,'',middle_name+' ') + isnull(last_name,'',last_name))
The rtrim will remove a trailing space where the person does not have a last name.
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
|
|
|
|
|
Hi i have created one web application and in that i need to read the data from Mysql database and bind to gridview.
I have written Mysql query as follows
SELECT @row_number:=@row_number+1 AS row_number,Name FROM tablename, (SELECT @row_number:=0) AS r
After running in Mysql in database it will and work show the result.
But if take same query and execute through C# code below error is coming.
An exception of type 'MySql.Data.MySqlClient.MySqlException' occurred in MySql.Data.dll but was not handled in user code
Additional information: Fatal error encountered during command execution.
and i will get Break or continue pop up. If i give continue it will show Parameter '@row_number' must be defined.
even i defined like int @row_number = 0; but same error.
I need to achieve serial number as shown below
ex in database
slno name
10102 nama1
2123 name2
5203 name3
result
1 nama1
2 name2
3 name3
how to achieve this. If anybody knows please reply me.
Thanks in advance.
|
|
|
|
|
This error occurs frequently and no insert query is running.
if i restart the sql server services it is working fine,but often getting this error message.
Recently i changed my management studio to 2012 as my server is 2008 R2 version.How to fix this issue permanently?
|
|
|
|
|
Hi,
Usually it's because there are corruption problems related to the storage system. Have you tried running DBCC CHECKDB against the database?
DBCC CHECKDB ('Your DB Name') WITH NO_INFOMSGS;
GO
This could give you more information.
Also, check the Auto Close property:
SELECT DATABASEPROPERTY ('Your DB Name', 'IsAutoClose');
GO
If it returns 1 (Auto Close is on), then that may be the reason of your problem...
Regards,
Andrius Leonavicius
|
|
|
|
|
Dear Sir,
It shows the following error
Msg 1823, Level 16, State 2, Line 1
A database snapshot cannot be created because it failed to start.
Msg 7928, Level 16, State 1, Line 1
The database snapshot for online checks could not be created.
Either the reason is given in a previous error or one of the underlying volumes
does not support sparse files or alternate streams. Attempting to get exclusive
access to run checks offline.
my database shows is_auto_close_on=1.
What i should do to solve this?
|
|
|
|