Showing posts with label includes. Show all posts
Showing posts with label includes. Show all posts

Monday, March 12, 2012

Query over two columns

Hi,
I have a table that includes two Datetime columns. The first column holds
the date. e.g 2006/5/10 and the second column holds time e,g 08:15:25.
I am having a problems specifing a query that will list the rows in the
table between a date time range.
i.e return all events between 2006/5/8 09:00:00 and 2006/5/10 21:30:00
Can anyone give me any suggesstions on how to do this?
Thanks
Maccawhy do you store it in two datetime columns?
or is it 2 varchar columns?
If so then try this.
select * from [a table]
where cast(datecol + ' ' + timecol as datetime) between
'2006/5/8 09:00:00' and '2006/5/10 21:30:00'|||Would it be an idea to have an overlay view where you make a
combination of both the date and the time field into a real datetime
format?|||Would it be an idea to have an overlay view where you make a
combination of both the date and the time field into a real datetime
format?

Query Output Custom Delimiter

Hello,

I have a SSMS query result set that includes columns which contain commas. I used the save as feature in the Results pane in SSMS but saves it as a comma delimited file. I tried to change the delimiter using in Query Options/Custom Delmiter to semi colon however it still saves it with a comma delimiter.

Any suggestions on how to change the delimiter?

Thanks

Are you using the save to file option for the query or are you selecting all the data and then saving it?

I ran this test, and I got the commas into a single column. The difference is that I made the file type *.*, and used a .TXT extension.

CREATE DATABASE TEST;

GO

USE TEST;

GO

CREATE TABLE TestComma (column1 varchar(30));

GO

INSERT INTO TestComma

VALUES ('This is a comma, test')

INSERT INTO TestComma

VALUES ('This is a comma, test')

INSERT INTO TestComma

VALUES ('This is a comma, test')

INSERT INTO TestComma

VALUES ('This is a comma, test');

GO

-- Now run this to save output into text file:

SELECT * FROM TestComma;

GO

-- Use the Save as feature:

SELECT * FROM TestComma;

GO

|||I selected all data in the query results window then saving it. The only option is to save it as a .csv file and I was wondering if that can be changed.|||

As I mentioned, use the *.* file type, and then specify a name. Then it's just text and not formatted as a CSV.

Query Output Custom Delimiter

Hello,

I have a SSMS query result set that includes columns which contain commas. I used the save as feature in the Results pane in SSMS but saves it as a comma delimited file. I tried to change the delimiter using in Query Options/Custom Delmiter to semi colon however it still saves it with a comma delimiter.

Any suggestions on how to change the delimiter?

Thanks

Are you using the save to file option for the query or are you selecting all the data and then saving it?

I ran this test, and I got the commas into a single column. The difference is that I made the file type *.*, and used a .TXT extension.

CREATE DATABASE TEST;

GO

USE TEST;

GO

CREATE TABLE TestComma (column1 varchar(30));

GO

INSERT INTO TestComma

VALUES ('This is a comma, test')

INSERT INTO TestComma

VALUES ('This is a comma, test')

INSERT INTO TestComma

VALUES ('This is a comma, test')

INSERT INTO TestComma

VALUES ('This is a comma, test');

GO

-- Now run this to save output into text file:

SELECT * FROM TestComma;

GO

-- Use the Save as feature:

SELECT * FROM TestComma;

GO

|||I selected all data in the query results window then saving it. The only option is to save it as a .csv file and I was wondering if that can be changed.|||

As I mentioned, use the *.* file type, and then specify a name. Then it's just text and not formatted as a CSV.

Saturday, February 25, 2012

Query Notifications

Hi there!
Which edition of SQL Server 2005 includes the Query Notifications?
Thanks
Klaus Aschenbrenner
www.csharp.at.www.anecon.com
http://weblogs.asp.net/klaus.aschenbrennerGood news ! Query Notification is available in SQL Server Express as
Service Broker is the underlying mechanism.
HTH, Jens Suessmeyer.
http://www.sqlserver2005.de
--