In SQL Server I have some textual data in varchar fields I am trying to convert to datetime's. The funny thing is this data at some point was in a datetime field, exported to flat file, and now I am reimporting it.
The problem is it is in this format 2010-02-14 20:18:58.313000000 and the conversion to datetime fails. I have no idea ho...
I'm trying to build a query for a medical database that counts the number of patients that were on at least one medication from a class of medications (the medications listed below in the FAST_MEDS CTE) and had either:
1) A diagnosis of myopathy (the list of diagnoses in the FAST_DX CTE)
2) A CPK lab value above 1000 (the lab value in th...
how can i convert a field contain data 733803 as into be datetime on sql server?
...
According to wikipedia!
http://en.wikipedia.org/wiki/ORDBMS
IBM's DB2, Oracle database, and
Microsoft SQL Server, make claims to
support this technology and do so with
varying degrees of success
So, are these products true "ORDBMS" like PostgreSQL? or they are they are long way from it? can someone plz! point me to any ...
I am trying to insert data from one of my existing table into another existing table.
Is it possible to insert data into any existing table using select * into query.
I think it can be done using union but in that case i need to record all data of my existing table into temporary table, then drop that table and finally than apply union...
Hello All,
I am developing a winform application in which user's login is validated through ms sql server 2000 database.When user entry its user name and password, application checks its exists in user table or not.
Now my requirement is if a user already login through one system it should not log in through another system.
if soluti...
So I need to connect to a mssql server via Windows Authentication from a Unix server. Here are the obstacles:
The db admin created a service account but made it Windows-Auth only, meaning I can't pass the username and password directly to the server to connect.
The admin also added my host's server to the firewall so that it would only...
EDIT:
How to format a date in sql sevrer with format dd-mm-yyyy to format yyyy-mm-dd. This format is not given in sql server but similar format is available yyyy/mm/dd
Is it there any such function in sql server 2008 or 2005
...
What is a good tool to see the differences between 2 tables (or even better, the datasets returned by 2 queries).
EDIT: I'm not interested in the schema changes. Just assume that the schemas are the same.
background as to why:
I'm porting some legacy code which can fill a database with some pre-calced data. The easiest way to see if I ...
Problem:
There are a lot of different databases, which is populated by many different applications directly (without any common application layer). Data can be accessed only through SP (by policy)
Task:
Application needs to track changes in these databases and react in minimal time.
Possible solutions:
1) Create trigger for each ta...
Possible Duplicate:
SQL Server Database query help
Hi,
I have a problem that I didn't manage to solve for a very long time, and I quite desperate.
I have a Database (SQL Server) with table named 'ProcessData' and columns named 'Process_Name' (Data Type: nvarchar(50)), 'Start_At' (DataType: DateTime) and 'End_At' (Data Type...
I am trying to fetch some records from table but when i use OR instead of AND it returns me few records but not in other case.
dates given exactly are present in table. What mistake i am doing ?
select newsid,title,detail,hotnews
from view_newsmaster
where datefrom>=CONVERT(datetime, '4-22-2010',111)
AND dateto<=CONVERT(datetime, '...
Hi all,
I need to export the results of a query to a csv file and put the file on a network shared folder.
Is it possible to achieve this within a stored procedure?
If yes, comes yet another constraint: can I achieve this without sysadmin privileges, aka without using xp_cmdshell + BCP utility?
If no to 2., does the caller have to h...
Hello Everyone,
I am struggling to write a query to result in the following records.
I have a table with records as
c1 c2 c3 c4 c5 c6
1 John 2.3.2010 12:09:54 4 7 99
2 mike 2.3.2010 13:09:59 8 6 88
3 ahmad 2.3.2010 14:09:59 1 9 19...
Something like this:
SELECT
*
FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS
WHERE CONSTRAINT_NAME ='FK_TreeNodesBinaryAssets_BinaryAssets'
and TABLE_NAME = 'TreeNodesBinaryAssets'
but for indexes.
...
I'm trying to use design a syncronisation application that syncs changes between different SQL Server databases.
I came up with a design based around receiving the ItemConflicting event, storing the knowledge associated with the conflict, and resolving all conflicts off-line.
However, it seems that I can only get the ApplyChangeFailed ...
Create table FavoriteDish
(
FavID int identity (1,1) primary key not null,
DishID int references Dishes(DishID) not null ,
CelebrityName nvarchar(100) nonclustered not null
)
This results in Incorrect syntax near the keyword 'nonclustered'.
I referred to the MSDN help for the create table syntax. I am not sure wha...
I have created a set of tables (around 20) in SQL Server 2008 and entered around 1000 records to appropriate tables.
But the issue is that I want that same tables with all the entered data into SQL Server 2005 (SQLEXPRESS).
Obviously it won't work by taking a backup and restore it into SQL Server 2005 as it won't support backward compa...
I am creating a comma separated value of columns specified in the dbName attribute of the XML below. Now I want to concatenate those columns on the basis of the Position attribute.
DECLARE @varXML AS XML =
'<gridFormat>
<column property="FacilityInternalID" dbName="Pname" HeaderText="TAT Healt...
Our team needs to insert a cruel amount of data into our SQL Server 2008 database. We're looking for a good solution. Now we came up with one, but I have doubts with it, simply because it doesn't feel right. So I'm asking here if this seems like a good solution. Extra challange is that it's a peer-to-peer replicated database over 4 serve...