|
hi,
can any one help me that how i convert already stored date value into varchar Data type into Datetime data type .
i have date in this format dd/MM/yyyy and is stored in varchar Data type how i convert whole dates data into datetime in above format .
i want to store only Date portion .iam using sql server 2000 data base .
Regards
Rameez
|
|
|
|
|
select convert(DateTime,dateColumn) from TableName
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
|
|
|
|
|
i have 2 table in sqlserver. i want do this command
insert into dabirestan (amuzeshgah) values (select amuzeshgah from dabirestan1)
i want fill the record of table dabirestan1 to table dabirestan
i want write a query. how is my query cammand. do any body know?
|
|
|
|
|
try
insert into dabirestan (amuzeshgah) select amuzeshgah from dabirestan1
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
|
|
|
|
|
What Blue_Boy suggested was 100% right in addition to it please make sure that the Second table you use should have the same Design or Table structure of what you are trying to copy to... otherwise the query would fail...
Cheers,
ZAK
|
|
|
|
|
Very excellent performance.. but i cant connect with database..
database error was displayed..
Microsoft OLEDB provider for ODBC drivers(0x80004005)
|
|
|
|
|
jeena9940220765 wrote: Very excellent performance.. but i cant connect with database..
database error was displayed..
Microsoft OLEDB provider for ODBC drivers(0x80004005)
Are you OK ? Please read this[^]
|
|
|
|
|
|
Hi all
I am working with SQL Server express edition. I want to save the results of my query in a text file.
SELECT UserName,JoinDate,PostCount FROM Posts
i have written this query in a SP. What i want is when i call the procedure the results should be saved in a text file.
Thanks
|
|
|
|
|
Do some research on CLR Stored procedure.
Parwej Ahamad
R & D: REST services with WCF
|
|
|
|
|
If you're using SSMS to connect to your SQL Server express instance, hit Ctrl + Shift + F and execute your SP.
|
|
|
|
|
Hi i have searched a lot and found that BCP can be used for this purpose.
Now i have written a simple query
Declare @str nvarchar(4000)
set @str='bcp "Select DISTINCT MAIN_ID from mydb.dbo.Postings " QUERYoUT "E:\Temp1.txt" -T'
Print(@str)
Execute master..xp_cmdshell @str
But i get the Output
SQLState = 08001, NativeError = 126
Error = [Microsoft][SQL Native Client]VIA Provider: The specified module could not be found.
NULL
SQLState = HYT00, NativeError = 0
Error = [Microsoft][SQL Native Client]Login timeout expired
SQLState = 08001, NativeError = 126
Error = [Microsoft][SQL Native Client]An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connecti
ons.
NULL
I have checked remote connections are enabled......
Looking forward for your reply.
Thanks
|
|
|
|
|
Your BCP command must have the -S "Server Name" included, or else it'll search for the default instance.
set @str='bcp "Select DISTINCT MAIN_ID from mydb.dbo.Postings " QUERYoUT "E:\Temp1.txt" -S InstanceName -T'
|
|
|
|
|
I find this easier to bring the result set to the client as a datatable and then write out the table as a CSV file. BCP is fine for ETL processes but there are a number of issues around security (passwords in clear) and file system permissions.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
|
Hi i want to find the given date is which saturday
It mean '7-5-2008' then its first saturday
If its '07-12-2008' then its second satuday
like that
Thanks & Regards,
NeW OnE,
please don't forget to vote on the post
modified on Friday, July 18, 2008 10:07 AM
|
|
|
|
|
What have you tried? Post what you have tried and people may be more open to helping. Most members of this site will not just hand you over something without seeing you really giving a solid effort at trying it yourself.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
New one wrote: please don't forget to vote on the post
Looks like people remembered...
|
|
|
|
|
Do some research on DATEADD (datepart , number, date ) function.
Always remember:
Without efforts nothing great is ever achieved.
Parwej Ahamad
R & D: REST services with WCF
|
|
|
|
|
Hi i need between two dates what are the working days are there like...,
In 2nd and 4th saturday workdays=5
and odd saturday workdays=6
Suppose if i give 7/2/2008 to 7/26/2008...,
Then I want these dates:
7/2/2008
7/3/2008
7/4/2008
7/5/2008
7/7/2008
7/8/2008
7/9/2008
7/10/2008
7/11/2008
7/14/2008
7/15/2008
7/16/2008
7/17/2008
7/18/2008
7/19/2008
7/18/2008
7/21/2008
7/22/2008
7/23/2008
7/24/2008
7/25/2008
7/26/2008
Any one plz help me regarding this...........,
Thanks & Regards,
NeW OnE,
please don't forget to vote on the post
|
|
|
|
|
Again, post what you have tried.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Hi,
Anyone could provide me solution. I have table like this
Date | Status
--------------------------------
12/07/08 | 2
12/07/08 | 3
12/07/08 | 3
13/07/08 | 2
13/07/08 | 3
13/07/08 | 2
----------------------------------
I want count of status on each day. For Clear understanding output should like this
Date | Total 2 | Total 3
---------------------------------
12/07/08 | 1 | 2
13/07/08 | 2 | 1
----------------------------------
Thanks
Binod K.
(Miles to go before I sleep)
|
|
|
|
|
This is what you need, BUT ... next time, post some code that you tried here so we know that we are not doing all your job
SELECT
Date
, [2] AS [Total 2]
, [3] AS [Total 3]
FROM YOUR_TABLE_NAME
PIVOT (
COUNT( Status )
FOR Status IN ( [2] , [3] )
) AS p
|
|
|
|
|
select distinct [date],<br />
(select count(t1.status) from MyTable as t1 where status=2 and t1.date=MyTable.[date]) as [Total 2],<br />
(select count(t1.status) from MyTable as t1 where status=3 and t1.date=MyTable.[date]) as [Total 3]<br />
from MyTable
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
|
|
|
|
|
hi
my data field is integer i give a query like this
select * from news where newsid like '123%'
it display error
i want to display news where my newsid is start with 123
please help me
|
|
|
|