Showing posts with label specific. Show all posts
Showing posts with label specific. Show all posts

Wednesday, March 21, 2012

Excluding weekend dates from calculated data pull

I have a business need to display some date specific data to a selcect group
of users 3 bussiness days before everyone else is allowed to see it.
THere are many fields I will be displaying across many tables. The date I am
using is ONLY in the primary table (meaning I don't have to include or
exclude data based on a date match from the other tables).
What I need to know is if there is a way in the SQL Query to not count the
weekend days as part of the 3 bussiness days. My query right now uses "WHERE
datafield < (GetDate + 5)". But this lets the users see data for the week's
Friday on the week's Monday. Not acceptable. If I only use "WHERE datafield <
(GetDate + 3) Then data to been displayed on This week's Tuesday can not be
seen on the previous Friday. Also Not Acceptable.
Any ideas?
Thanks.
Carrie E. Wells
Web Architect/Developer
Oh, and if Ihave this posted int eh wrong place tell me where to put it an I
move it.
On Wed, 25 May 2005 08:43:25 -0700, Wells wrote:
(snip)
>What I need to know is if there is a way in the SQL Query to not count the
>weekend days as part of the 3 bussiness days. My query right now uses "WHERE
>datafield < (GetDate + 5)". But this lets the users see data for the week's
>Friday on the week's Monday. Not acceptable. If I only use "WHERE datafield <
>(GetDate + 3) Then data to been displayed on This week's Tuesday can not be
>seen on the previous Friday. Also Not Acceptable.
Hi Carrie,
The simple, quick and dirty solution would be to use a CASE expression
to add either 3 or 5 to the current date, depending on the result of
DATEPART(day, GetDate()). But that would not take public holidays and
company holidays into account.
The best solution is to use a calendar table. You'll have to create it
once; after that, you can use it in this and many other situations. How
to make a calendar table, and many possible usees, is described at this
site: http://www.aspfaq.com/show.asp?id=2519

>Oh, and if Ihave this posted int eh wrong place tell me where to put it an I
>move it.
I don't think you can move posts on Usenet :-)
Anyway, this group is actually intended for MSEQ (Microsoft English
Query). In practice, nobody ever posts anything about MSEQ, but the
group does catch some stray questions about SQL Server queries.
A better place for this kind of questions is the programming group at
microsoft.public.sqlserver.programming. That group is frequented by many
more experts than this one.
Best, Hugo
(Remove _NO_ and _SPAM_ to get my e-mail address)
|||Since the site is 24/7 then that should be ok. The whole reason for 3 days
was to work around the schedules of our foriegn customers, who of course
don't have the same holidays. This issue was about certian Key Customers
getting the data first but not before the company rules said they could.
Thanks for the solution. I never even thought about using a Case statement
and this has been driving me crazy for two weeks. :-)
Thanks Again,
Carrie Wells
Carrie E. Wells
Web Architect/Developer
"Hugo Kornelis" wrote:

> On Wed, 25 May 2005 08:43:25 -0700, Wells wrote:
> (snip)
> Hi Carrie,
> The simple, quick and dirty solution would be to use a CASE expression
> to add either 3 or 5 to the current date, depending on the result of
> DATEPART(day, GetDate()). But that would not take public holidays and
> company holidays into account.
> The best solution is to use a calendar table. You'll have to create it
> once; after that, you can use it in this and many other situations. How
> to make a calendar table, and many possible usees, is described at this
> site: http://www.aspfaq.com/show.asp?id=2519
>
> I don't think you can move posts on Usenet :-)
> Anyway, this group is actually intended for MSEQ (Microsoft English
> Query). In practice, nobody ever posts anything about MSEQ, but the
> group does catch some stray questions about SQL Server queries.
> A better place for this kind of questions is the programming group at
> microsoft.public.sqlserver.programming. That group is frequented by many
> more experts than this one.
> Best, Hugo
> --
> (Remove _NO_ and _SPAM_ to get my e-mail address)
>

Exclude table from transaction log

Hi
Does anyone know if it is possible that changes to a specific table are not
recorded in the transaction log while changes to other tables are ?
If yes how can this be done?
Thanks
Daniel
Message posted via http://www.droptable.comThat's not possible. Why do you want to do this?
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Toronto, ON Canada
"DANR via droptable.com" <u26179@.uwe> wrote in message
news:662d81586fb67@.uwe...
Hi
Does anyone know if it is possible that changes to a specific table are not
recorded in the transaction log while changes to other tables are ?
If yes how can this be done?
Thanks
Daniel
Message posted via http://www.droptable.com|||Hi,
No. We can not do that. SQL Server engine by itself will log all the
transactions in to transaction log file.
Thanks
Hari
SQL Server MVP
"DANR via droptable.com" <u26179@.uwe> wrote in message
news:662d81586fb67@.uwe...
> Hi
> Does anyone know if it is possible that changes to a specific table are
> not
> recorded in the transaction log while changes to other tables are ?
> If yes how can this be done?
> Thanks
> Daniel
> --
> Message posted via http://www.droptable.com
>|||Hi Tom
Because I have a table were I register several informations with thousands o
f
records but the information is not really critical and if something goes
wrong I don't need to recover that information.
This information is increasing the size of the transaction log without being
really necessary.
Thanks
Daniel
Tom Moreau wrote:
>That's not possible. Why do you want to do this?
>Hi
>Does anyone know if it is possible that changes to a specific table are not
>recorded in the transaction log while changes to other tables are ?
>If yes how can this be done?
>Thanks
>Daniel
Message posted via http://www.droptable.com|||Ok Hari
Thanks
Daniel
Hari Prasad wrote:[vbcol=seagreen]
>Hi,
>No. We can not do that. SQL Server engine by itself will log all the
>transactions in to transaction log file.
>Thanks
>Hari
>SQL Server MVP
>
>[quoted text clipped - 5 lines]
Message posted via droptable.com
http://www.droptable.com/Uwe/Forum...server/200609/1|||If you don't need that this table is time-correlated with the rest of the ta
ble in your backups,
consider putting it in its own database. Also, this database can be in simpl
e recovery mode and you
can investigate if it is possible to input the data using a minimally logged
operation (bulk loading
is probably the best bet).
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"DANR via droptable.com" <u26179@.uwe> wrote in message news:662ee8ef93f81@.uwe...reen">
> Hi Tom
> Because I have a table were I register several informations with thousands
of
> records but the information is not really critical and if something goes
> wrong I don't need to recover that information.
> This information is increasing the size of the transaction log without bei
ng
> really necessary.
> Thanks
> Daniel
>
> Tom Moreau wrote:
> --
> Message posted via http://www.droptable.com
>|||Hi Tibor
Thanks for your sugestion. I already thought using that approach.
I just asked because maybe someone know other way.
Thanks to all
Regards
Daniel
Tibor Karaszi wrote:[vbcol=seagreen]
>If you don't need that this table is time-correlated with the rest of the t
able in your backups,
>consider putting it in its own database. Also, this database can be in simp
le recovery mode and you
>can investigate if it is possible to input the data using a minimally logge
d operation (bulk loading
>is probably the best bet).
>
>[quoted text clipped - 16 lines]
Message posted via http://www.droptable.com

Exclude table from transaction log

Hi
Does anyone know if it is possible that changes to a specific table are not
recorded in the transaction log while changes to other tables are ?
If yes how can this be done?
Thanks
Daniel
--
Message posted via http://www.sqlmonster.comThat's not possible. Why do you want to do this?
--
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Toronto, ON Canada
"DANR via SQLMonster.com" <u26179@.uwe> wrote in message
news:662d81586fb67@.uwe...
Hi
Does anyone know if it is possible that changes to a specific table are not
recorded in the transaction log while changes to other tables are ?
If yes how can this be done?
Thanks
Daniel
--
Message posted via http://www.sqlmonster.com|||Hi,
No. We can not do that. SQL Server engine by itself will log all the
transactions in to transaction log file.
Thanks
Hari
SQL Server MVP
"DANR via SQLMonster.com" <u26179@.uwe> wrote in message
news:662d81586fb67@.uwe...
> Hi
> Does anyone know if it is possible that changes to a specific table are
> not
> recorded in the transaction log while changes to other tables are ?
> If yes how can this be done?
> Thanks
> Daniel
> --
> Message posted via http://www.sqlmonster.com
>|||Hi Tom
Because I have a table were I register several informations with thousands of
records but the information is not really critical and if something goes
wrong I don't need to recover that information.
This information is increasing the size of the transaction log without being
really necessary.
Thanks
Daniel
Tom Moreau wrote:
>That's not possible. Why do you want to do this?
>Hi
>Does anyone know if it is possible that changes to a specific table are not
>recorded in the transaction log while changes to other tables are ?
>If yes how can this be done?
>Thanks
>Daniel
--
Message posted via http://www.sqlmonster.com|||Ok Hari
Thanks
Daniel
Hari Prasad wrote:
>Hi,
>No. We can not do that. SQL Server engine by itself will log all the
>transactions in to transaction log file.
>Thanks
>Hari
>SQL Server MVP
>> Hi
>[quoted text clipped - 5 lines]
>> Thanks
>> Daniel
--
Message posted via SQLMonster.com
http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server/200609/1|||If you don't need that this table is time-correlated with the rest of the table in your backups,
consider putting it in its own database. Also, this database can be in simple recovery mode and you
can investigate if it is possible to input the data using a minimally logged operation (bulk loading
is probably the best bet).
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"DANR via SQLMonster.com" <u26179@.uwe> wrote in message news:662ee8ef93f81@.uwe...
> Hi Tom
> Because I have a table were I register several informations with thousands of
> records but the information is not really critical and if something goes
> wrong I don't need to recover that information.
> This information is increasing the size of the transaction log without being
> really necessary.
> Thanks
> Daniel
>
> Tom Moreau wrote:
>>That's not possible. Why do you want to do this?
>>Hi
>>Does anyone know if it is possible that changes to a specific table are not
>>recorded in the transaction log while changes to other tables are ?
>>If yes how can this be done?
>>Thanks
>>Daniel
> --
> Message posted via http://www.sqlmonster.com
>|||Hi Tibor
Thanks for your sugestion. I already thought using that approach.
I just asked because maybe someone know other way.
Thanks to all
Regards
Daniel
Tibor Karaszi wrote:
>If you don't need that this table is time-correlated with the rest of the table in your backups,
>consider putting it in its own database. Also, this database can be in simple recovery mode and you
>can investigate if it is possible to input the data using a minimally logged operation (bulk loading
>is probably the best bet).
>> Hi Tom
>[quoted text clipped - 16 lines]
>>Thanks
>>Daniel
--
Message posted via http://www.sqlmonster.comsql

Wednesday, February 15, 2012

Excel Output

I want to run a stored procedure which will run a specific query and put out
a monthly file each month. The name of the file with be "jan.xls" for Jan
data and then the next month it will be "feb.xls" for Feb. In addition, I
want to place the output in a folder which cooresponds month it is.
If I run a query, is there a way for me to put out an xls file? I see that
I can do this via DTS, but is this the only way?
I am guessing that I can invoke a DTS package from within a stored
procedure, but I am not sure how I would vary the output name. Maybe I woul
d
put out a standard name and then within the stored procedure generate the do
s
commands to rename and move the output as desired. Seems fairly complex for
something which seems to be fairly simple and common.
So I am kind of new to SQL, so I am just trying to get up to speed.
What approach would be recommended?
Thanks in advance for your assistance!!!I reckon the easiest way to do all this is with a ActiveX task within a DTS
package. You could use a SQL Task or ADO to extract the information to a
recordset, the Excel object library to manipulate and save the data and the
FileSystemObject object library to move/create files and directories. Within
VB Script you could build your filename dynamically too.
You would probably want to do some performance testing though.
"Jim Heavey" wrote:

> I want to run a stored procedure which will run a specific query and put o
ut
> a monthly file each month. The name of the file with be "jan.xls" for Jan
> data and then the next month it will be "feb.xls" for Feb. In addition, I
> want to place the output in a folder which cooresponds month it is.
> If I run a query, is there a way for me to put out an xls file? I see tha
t
> I can do this via DTS, but is this the only way?
> I am guessing that I can invoke a DTS package from within a stored
> procedure, but I am not sure how I would vary the output name. Maybe I wo
uld
> put out a standard name and then within the stored procedure generate the
dos
> commands to rename and move the output as desired. Seems fairly complex f
or
> something which seems to be fairly simple and common.
> So I am kind of new to SQL, so I am just trying to get up to speed.
> What approach would be recommended?
> Thanks in advance for your assistance!!!

Excel Output

I want to run a stored procedure which will run a specific query and put out
a monthly file each month. The name of the file with be "jan.xls" for Jan
data and then the next month it will be "feb.xls" for Feb. In addition, I
want to place the output in a folder which cooresponds month it is.
If I run a query, is there a way for me to put out an xls file? I see that
I can do this via DTS, but is this the only way?
I am guessing that I can invoke a DTS package from within a stored
procedure, but I am not sure how I would vary the output name. Maybe I would
put out a standard name and then within the stored procedure generate the dos
commands to rename and move the output as desired. Seems fairly complex for
something which seems to be fairly simple and common.
So I am kind of new to SQL, so I am just trying to get up to speed.
What approach would be recommended?
Thanks in advance for your assistance!!!I reckon the easiest way to do all this is with a ActiveX task within a DTS
package. You could use a SQL Task or ADO to extract the information to a
recordset, the Excel object library to manipulate and save the data and the
FileSystemObject object library to move/create files and directories. Within
VB Script you could build your filename dynamically too.
You would probably want to do some performance testing though.
"Jim Heavey" wrote:
> I want to run a stored procedure which will run a specific query and put out
> a monthly file each month. The name of the file with be "jan.xls" for Jan
> data and then the next month it will be "feb.xls" for Feb. In addition, I
> want to place the output in a folder which cooresponds month it is.
> If I run a query, is there a way for me to put out an xls file? I see that
> I can do this via DTS, but is this the only way?
> I am guessing that I can invoke a DTS package from within a stored
> procedure, but I am not sure how I would vary the output name. Maybe I would
> put out a standard name and then within the stored procedure generate the dos
> commands to rename and move the output as desired. Seems fairly complex for
> something which seems to be fairly simple and common.
> So I am kind of new to SQL, so I am just trying to get up to speed.
> What approach would be recommended?
> Thanks in advance for your assistance!!!