Showing posts with label save. Show all posts
Showing posts with label save. Show all posts

Monday, March 12, 2012

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.

Monday, February 20, 2012

query needed for path navigation through a web site

hi experts,
i'm working in building new reports from an existing database. the report i'm working in is to save the path of the visitor through a web site(this is neede for the statistics web site), i have the siteId, commid, maintab, subtab.
the site id is dtored in site table, maintab and subtab are stored in article(they are mixed in one columns called title) i have also sessionid stored in session table.
i want a query that show the flow of the visitor through a web site, which tab he clicked first then second tab then third tab and in this tab he clicked subtab and the last tab he clicked on before leaving the web page.
is this possible and if not, what are the other approches that can i make to get the report i want.
also i want to ask if it is possible to create the report where it will show you the visitors for the first time and the returned visitors.
thanksHow do you determine the order of the pages visited? Are you storing timestamps or incrementally increasing IDs?|||hi,
thanks for the answer, actually i'm storing also the timestamp, and i think you have a point there, a timestamp is a good way to know the order, but i think a lot of information will be stored in the database if i decided to store the timestamp, do you have any other approach because at this time we can not afford tos tore a lot of information?
thanks|||A datetime column is not going to take up a lot of disk space. I can't think of any solution that would be cheaper in terms of bytes except an auto-incrementing identity surrogate key, and this is not the intended use of surrogate keys.|||there are plenty of 3rd party apps that do all this - you are reinventing the wheel if you code it yourself.

have you looked at google analytics?
http://www.google.com/analytics/|||ok.
blindman, how can i get the path order according to tmestamp do you have an idea or a query that can do that?
jezemine, can you explain more.

what about the report for showing the returning visitors?
thanks|||I use google analytics to analyze traffic on my website. I find it very good, and it's free. You can do all sorts of stuff, like see where people are referred from, most common navigation paths they take through your site, etc.

Did you look at the link I provided?

also there are a ton of 3rd party apps for parsing web logs, many are free and the ones that aren't almost always have trial versions. all you need to do is look for them:

http://www.google.com/search?q=web+log+analysis|||ok.
blindman, how can i get the path order according to tmestamp do you have an idea or a query that can do that?
jezemine, can you explain more.

what about the report for showing the returning visitors?
thanks
Okay, assuming you have the timestamp that will give you the order in which the pages were visited. Then you just need a way to differentiate between the different people/logins/connections that visit each page. What is your method of accomplishing this?|||thanks for your answers and sorry for being late to answer back.
i have all th information stored about the user, i have sessionid,siteid, i did not think of it yet, but in your point of view which one is the best?
any ideas?!!!
i will take a look also to the link you give me.
thanks|||So can't you just sort your data by sessionid and timestamp to get the order of the pages visited?|||hi,
can you give me an example or a query how to do it?
thanks|||select * from YourData order by SessionID, TimeStamp

What is the problem here?|||it seems too easy but i think you are right.
i will work on the report and i will post back if there is a problem, thaks for your help.
what about the report to store the IP's any idea about that.
thanks again and have a nice week end