Showing posts with label script. Show all posts
Showing posts with label script. Show all posts

Monday, March 19, 2012

Can MS-SQL Access photo datatype data?

I am wondering if the MS-SQL can read or write files of photo-typed data.
What method or script I should notice if MS-SQL is no problem on accessing
photo-typed data.

Thanks any way!

Wilbertsorry, not following you there I'm afraid, can you clarify your question?

j|||Sorry for my poor English. I am from Taiwan.
Actually I have seen the artiles you posted on this Forums.
And thank you again for looking at my question.
Ok, I try my best to clarify my question.
I want to make a webpage which connects to a DB in order to for user upload or download image data from DB.
Primaryly I want to take advantage of DB to manage image data instead of a file folders created at purpose for storing image data.
That's all

Thank you, Atrax|||ah, I see. . I thought youmight mean this but wasn't sure.

my usualy advice is don't store image data (or other potentially large binaries) in SQL Server unless you have a very, very good reason. 99 times out of 100 it's better to store the image itself as a file, and then store the path to the file in the SQL Server. Storing a lot of image data can bloat your database rapidly, is more work to display (hence more strain on the server) and less easy to move around.

this isn't to say it can't be done - I've done it in the past - but it IS to say usually it's not such a grand idea. Have you got a good reason to do so?|||Actually that advice is out of date. It was still true to some extent for SS7 but MS did a lot of work to optimize SS2K for storing binary data. I think it was in response to other database engines that do it efficiently.

There should be an architectural reason to store binary data or to avoid it. But it just doesn't drain SQL Server like it used to.

Don|||storage isn't as bad as it used to be, but pulling data backwards and forwards, as you probably would - is less efficient. that's the major reason.|||Well,
First of all, I have to say in advanced that I am new to coding with vb.net even the
MS-SQL. For the security issue and efficiency in management of data ,
using folders or DB to stroe image data , which way is better? and Why?

Thank you all,

Wilbert|||That's hard to say. It really is an architectural decision that depends on the requirements of your app.

First, what is the security issue? Are you trying to protect the binary images or the other data in the database? Do you want to control access to the images? You can do that using Windows file system security. What is required for your application?

The answer to what is most efficient depends on how you're using the images. Are they in constant use, or might a particular image be accessed only once a year? How large are they? How many are there? Do you have to store a lot of information with them in the records?

Tell us more about your application and we'll try to give you more specifics.

Don|||Hi donkiely,

In my work place, one of my job now is to post the image to our website
and keep the imformation up to date. For this website just start, the data now is not huge.
These image are photoed from newspapers. We will find news related to my company on newspaper. If there are news which are suitable for posting to our website. I take it down.
We are setting these thing to record what thing happen in our company.
Sometime I will just take one picture a day and sometime I also could take more 10 pictures a day. Something I am sure that the quantity will go up quickly.
As the information above, Can it give you a picture or architectural thing that might
help my question.

With Regards

P.S. Please be patient of my poor English.

Wilbert|||Hi Wilbert,

That sounds like a reasonable use of images in the db, based on your description.

Here's an article that will give you the details.

Don|||Thank you, Donkiely

Can MSDE work as SQL Server?

I plan on replacing a SQL2000 database with MSDE for lowering budget.
Can we script up the SQL database (with SPs, triggers, and UDFs) and recreate it in MSDE?
Thanks.All SQL Server code will work fine on MSDE. The restriction is that it is restricted to 8 concurrent operations. At that point, there is a governer that kiks in to slow down operations.

http://msdn.microsoft.com/library/?url=/library/en-us/architec/8_ar_sa2_0ciq.asp?frame=true

http://www.microsoft.com/sql/msde/|||How can we create/maintain tables, views, stored procedures, triggers and UDFs in MSDE?
Thanks|||through SQL code. CREATE TABLE, CREATE VIEW, ALTER PRCEDURE etc... see Books Online

(you can also connect with the SQL Server client tools, and other SQL Server management tools can be found on the web)

Wednesday, March 7, 2012

Can I use SQL 2005 script to create SQL 2000 database?

Can I use a script generated in SQL 2005 to create a database on a SQL 2000
server?
We're migrating from SQL 2000 to SQL 2005, and at the same time doing a
major upgrade to an existing SQL 2000 database. Another group created the
new database in SQL 2005 on a remote test server. I connected to the test
server and generated a script to recreate the database on another server
running SQL 2000.
Any help would be appreciated.
John
John,
As long as the script does not use any 2005 features it will work fine. But
if that was not thought about at script generation, then you may have a few
problems.
If you use the scripting tools in SQL Server Management Studio 2005 to
create a script from a database on a 2005 server, you will see that you can
choose the option to create a 2000 or a 2005 script. They are a little
different, so if that is how they generated your script, perhaps they can
(re)generate using the 2000 format.
RLF
"John Steen" <moderndads(nospam)@.hotmail.com> wrote in message
news:BD83397B-F6A9-4153-ABCF-9E84D2E7AC5D@.microsoft.com...
> Can I use a script generated in SQL 2005 to create a database on a SQL
> 2000
> server?
> We're migrating from SQL 2000 to SQL 2005, and at the same time doing a
> major upgrade to an existing SQL 2000 database. Another group created the
> new database in SQL 2005 on a remote test server. I connected to the test
> server and generated a script to recreate the database on another server
> running SQL 2000.
> Any help would be appreciated.
> John
|||Thanks for the quick reply, Russell. I'll let the other group know to
regenerate the script for 2000.
John
"Russell Fields" wrote:

> John,
> As long as the script does not use any 2005 features it will work fine. But
> if that was not thought about at script generation, then you may have a few
> problems.
> If you use the scripting tools in SQL Server Management Studio 2005 to
> create a script from a database on a 2005 server, you will see that you can
> choose the option to create a 2000 or a 2005 script. They are a little
> different, so if that is how they generated your script, perhaps they can
> (re)generate using the 2000 format.
> RLF
> "John Steen" <moderndads(nospam)@.hotmail.com> wrote in message
> news:BD83397B-F6A9-4153-ABCF-9E84D2E7AC5D@.microsoft.com...
>
>

Can I use SQL 2005 script to create SQL 2000 database?

Can I use a script generated in SQL 2005 to create a database on a SQL 2000
server?
We're migrating from SQL 2000 to SQL 2005, and at the same time doing a
major upgrade to an existing SQL 2000 database. Another group created the
new database in SQL 2005 on a remote test server. I connected to the test
server and generated a script to recreate the database on another server
running SQL 2000.
Any help would be appreciated.
JohnJohn,
As long as the script does not use any 2005 features it will work fine. But
if that was not thought about at script generation, then you may have a few
problems.
If you use the scripting tools in SQL Server Management Studio 2005 to
create a script from a database on a 2005 server, you will see that you can
choose the option to create a 2000 or a 2005 script. They are a little
different, so if that is how they generated your script, perhaps they can
(re)generate using the 2000 format.
RLF
"John Steen" <moderndads(nospam)@.hotmail.com> wrote in message
news:BD83397B-F6A9-4153-ABCF-9E84D2E7AC5D@.microsoft.com...
> Can I use a script generated in SQL 2005 to create a database on a SQL
> 2000
> server?
> We're migrating from SQL 2000 to SQL 2005, and at the same time doing a
> major upgrade to an existing SQL 2000 database. Another group created the
> new database in SQL 2005 on a remote test server. I connected to the test
> server and generated a script to recreate the database on another server
> running SQL 2000.
> Any help would be appreciated.
> John|||Thanks for the quick reply, Russell. I'll let the other group know to
regenerate the script for 2000.
John
"Russell Fields" wrote:
> John,
> As long as the script does not use any 2005 features it will work fine. But
> if that was not thought about at script generation, then you may have a few
> problems.
> If you use the scripting tools in SQL Server Management Studio 2005 to
> create a script from a database on a 2005 server, you will see that you can
> choose the option to create a 2000 or a 2005 script. They are a little
> different, so if that is how they generated your script, perhaps they can
> (re)generate using the 2000 format.
> RLF
> "John Steen" <moderndads(nospam)@.hotmail.com> wrote in message
> news:BD83397B-F6A9-4153-ABCF-9E84D2E7AC5D@.microsoft.com...
> > Can I use a script generated in SQL 2005 to create a database on a SQL
> > 2000
> > server?
> >
> > We're migrating from SQL 2000 to SQL 2005, and at the same time doing a
> > major upgrade to an existing SQL 2000 database. Another group created the
> > new database in SQL 2005 on a remote test server. I connected to the test
> > server and generated a script to recreate the database on another server
> > running SQL 2000.
> >
> > Any help would be appreciated.
> >
> > John
>
>

Can I use SQL 2005 script to create SQL 2000 database?

Can I use a script generated in SQL 2005 to create a database on a SQL 2000
server?
We're migrating from SQL 2000 to SQL 2005, and at the same time doing a
major upgrade to an existing SQL 2000 database. Another group created the
new database in SQL 2005 on a remote test server. I connected to the test
server and generated a script to recreate the database on another server
running SQL 2000.
Any help would be appreciated.
JohnJohn,
As long as the script does not use any 2005 features it will work fine. But
if that was not thought about at script generation, then you may have a few
problems.
If you use the scripting tools in SQL Server Management Studio 2005 to
create a script from a database on a 2005 server, you will see that you can
choose the option to create a 2000 or a 2005 script. They are a little
different, so if that is how they generated your script, perhaps they can
(re)generate using the 2000 format.
RLF
"John Steen" <moderndads(nospam)@.hotmail.com> wrote in message
news:BD83397B-F6A9-4153-ABCF-9E84D2E7AC5D@.microsoft.com...
> Can I use a script generated in SQL 2005 to create a database on a SQL
> 2000
> server?
> We're migrating from SQL 2000 to SQL 2005, and at the same time doing a
> major upgrade to an existing SQL 2000 database. Another group created the
> new database in SQL 2005 on a remote test server. I connected to the test
> server and generated a script to recreate the database on another server
> running SQL 2000.
> Any help would be appreciated.
> John|||Thanks for the quick reply, Russell. I'll let the other group know to
regenerate the script for 2000.
John
"Russell Fields" wrote:

> John,
> As long as the script does not use any 2005 features it will work fine. B
ut
> if that was not thought about at script generation, then you may have a fe
w
> problems.
> If you use the scripting tools in SQL Server Management Studio 2005 to
> create a script from a database on a 2005 server, you will see that you ca
n
> choose the option to create a 2000 or a 2005 script. They are a little
> different, so if that is how they generated your script, perhaps they can
> (re)generate using the 2000 format.
> RLF
> "John Steen" <moderndads(nospam)@.hotmail.com> wrote in message
> news:BD83397B-F6A9-4153-ABCF-9E84D2E7AC5D@.microsoft.com...
>
>

Friday, February 24, 2012

Can I speed up this script...help?

Ok,
This script is something I wrote for bringing up a report in reporting
services and it is really slow...Is their any problems with it or is
their better syntax to speed it up and still provide the same report
results?:

SELECT t1.MemberId, t1.PeriodID, t8.start_date, t6.amount_type_id,
t6.amount_type,
SUM(CASE WHEN t2.amountTypeId = 7 THEN t2.amount
WHEN t2.amountTypeId = 23 THEN - t2.amount END) AS Purchase,
SUM(CASE WHEN t2.amountTypeId = 8 THEN t2.amount
WHEN t2.amountTypeId = 24 THEN - t2.amount END) AS Matrix,
SUM(CASE WHEN t2.amountTypeId = 20 THEN t2.amount
WHEN t2.amountTypeId = 21 THEN - t2.amount END) AS QualiFly,
SUM(CASE WHEN t2.amountTypeId = 9 THEN t2.amount
WHEN t2.amountTypeId = 25 THEN - t2.amount END) AS Dist,
SUM(CASE WHEN t2.amountTypeId = 10 THEN t2.amount
WHEN t2.amountTypeId = 26 THEN - t2.amount END) AS SM,
SUM(CASE WHEN t2.amountTypeId = 11 THEN t2.amount
WHEN t2.amountTypeId = 27 THEN - t2.amount END) AS BreakAway,
SUM(CASE WHEN t2.amountTypeId = 13 THEN t2.amount
WHEN t2.amountTypeId = 14 THEN - t2.amount END) AS Transfer,
SUM(CASE WHEN t2.amountTypeId = 28 THEN t2.amount
WHEN t2.amountTypeId = 15 THEN - t2.amount END) AS Spent
FROM tblTravelDetail t1 INNER JOIN
tblTravelDetailAmount t2 ON t1.TravelDetailId =
t2.TravelDetailId INNER JOIN
tblTravelDetail t3 ON t2.TravelDetailId =
t3.TravelDetailId INNER JOIN
tblTravelDetailMember t4 ON t3.TravelDetailId =
t4.TravelDetailId INNER JOIN
tblTravelEvent t5 ON t1.TravelEventId =
t5.TravelEventId INNER JOIN
amount_type t6 ON t2.amountTypeId =
t6.amount_type_id INNER JOIN
period t8 ON t1.PeriodID = t8.period_id
WHERE (t1.MemberId = @.MemberId) AND (t2.amount <> 0)
GROUP BY t1.MemberId, t1.PeriodID, t8.start_date, t6.amount_type_id,
t6.amount_type

Any help is appreciated.
Thanks,
TrintThere's no way for us to answer that without seeing your execution
plan. What are your indexes like?

Stu|||On 27 Sep 2005 04:51:43 -0700, trint wrote:

>Ok,
>This script is something I wrote for bringing up a report in reporting
>services and it is really slow...Is their any problems with it or is
>their better syntax to speed it up and still provide the same report
>results?:
>SELECT t1.MemberId, t1.PeriodID, t8.start_date, t6.amount_type_id,
>t6.amount_type,
> SUM(CASE WHEN t2.amountTypeId = 7 THEN t2.amount
>WHEN t2.amountTypeId = 23 THEN - t2.amount END) AS Purchase,
> SUM(CASE WHEN t2.amountTypeId = 8 THEN t2.amount
>WHEN t2.amountTypeId = 24 THEN - t2.amount END) AS Matrix,
> SUM(CASE WHEN t2.amountTypeId = 20 THEN t2.amount
>WHEN t2.amountTypeId = 21 THEN - t2.amount END) AS QualiFly,
> SUM(CASE WHEN t2.amountTypeId = 9 THEN t2.amount
>WHEN t2.amountTypeId = 25 THEN - t2.amount END) AS Dist,
> SUM(CASE WHEN t2.amountTypeId = 10 THEN t2.amount
>WHEN t2.amountTypeId = 26 THEN - t2.amount END) AS SM,
> SUM(CASE WHEN t2.amountTypeId = 11 THEN t2.amount
>WHEN t2.amountTypeId = 27 THEN - t2.amount END) AS BreakAway,
> SUM(CASE WHEN t2.amountTypeId = 13 THEN t2.amount
>WHEN t2.amountTypeId = 14 THEN - t2.amount END) AS Transfer,
> SUM(CASE WHEN t2.amountTypeId = 28 THEN t2.amount
>WHEN t2.amountTypeId = 15 THEN - t2.amount END) AS Spent
>FROM tblTravelDetail t1 INNER JOIN
> tblTravelDetailAmount t2 ON t1.TravelDetailId =
>t2.TravelDetailId INNER JOIN
> tblTravelDetail t3 ON t2.TravelDetailId =
>t3.TravelDetailId INNER JOIN
> tblTravelDetailMember t4 ON t3.TravelDetailId =
>t4.TravelDetailId INNER JOIN
> tblTravelEvent t5 ON t1.TravelEventId =
>t5.TravelEventId INNER JOIN
> amount_type t6 ON t2.amountTypeId =
>t6.amount_type_id INNER JOIN
> period t8 ON t1.PeriodID = t8.period_id
>WHERE (t1.MemberId = @.MemberId) AND (t2.amount <> 0)
>GROUP BY t1.MemberId, t1.PeriodID, t8.start_date, t6.amount_type_id,
>t6.amount_type
>Any help is appreciated.
>Thanks,
>Trint

Hi Trint,

My first observation is that the join to the second instance of table
tblTravelDetail (the one aliased as t3) is redundant - it will simply
provide yet another copy of each row in the first instance of the same
table (aliased as t1). Remove this join and change all references to the
alias t3 to t1.

Next, I note that the tables tblTravelDetailMember and tblTravelEvent
(aliased as t4 and t5) are not used in the query at all. You can quite
probably remove these two tables from the FROM clause and still get the
same results.

If, after these modifications, the query still runs too slow, than
please provide more information. The minimum information required is:
- Complete information about your design: all tables (as CREATE TABLE
statements, including all constraints and properties), all indexes (as
CREATE INDEX statements, unless the index is created as a side effect of
a constraint), and some information about the estimated number of rows
in each table;
- The exact query that you ran (i.e. after making the modifications I
suggested above);
- The actual execution plan (use SET SHOWPLAN TEXT ON to get this
information in a format that you can copy in the newsgroups);
- The time the query took, and the time you think it ought to take.

The following extra information is also very usefull:
- Some rows of sample data that help to illustrate what the query should
achieve (posted as INSERT statements);
- The expected output of the query for those statements (not needed if
the query in your messages produces that resutls);
- A short description of the business problem that you're trying to
solve with this query.

Best, Hugo
--

(Remove _NO_ and _SPAM_ to get my e-mail address)|||Trint,

It looks pretty good so far. Your indexes are very important, since the
WHERE clause is probably not very restrictive, and you have many joins
(some of which may be unnecessary). So in addition to Hugo's advice the
following tips:

1) Make sure you have proper indexes in place. You could consider using
the Index Tuning Wizard, or you could add many indexes yourself, check
the execution plan, and remove all unused indexes. When doing that, you
could also consider covering indexes.

For example, you could create the following (temporary) indexes for
table tblTravelDetailAmount :
- tblTravelDetailAmount (TravelDetailId, amountTypeId)
- tblTravelDetailAmount (TravelDetailId, amountTypeId, amount)
- tblTravelDetailAmount (amountTypeId, TravelDetailId, amount)
If there is a clustered index on TravelDetailID, then you could add the
following (temporary) indexes:
- tblTravelDetailAmount (amountTypeId)
- tblTravelDetailAmount (amountTypeId, amount)

2) Remove the t2.amount <> 0 predicate from the query, and check if this
makes the query run faster or slower

3) Table amount_type seems to be a lookup table. If it is, then make
sure that in addition to the Primary Key (on amount_type_id), the table
also has a Unique constraint (or index) on the description column (on
amount_type). If the query does not benefit from this, then you could
consider rewriting the query to this:

SELECT t1.MemberId, t1.PeriodID, t8.start_date,
t6.amount_type_id, MIN(t6.amount_type) AS amount_type, ...
// added MIN() on this line
FROM tblTravelDetail t1 ...
WHERE (t1.MemberId = @.MemberId)
GROUP BY t1.MemberId, t1.PeriodID, t8.start_date, t6.amount_type_id
// removed amount_type from this line

Hope this helps,
Gert-Jan

trint wrote:
> Ok,
> This script is something I wrote for bringing up a report in reporting
> services and it is really slow...Is their any problems with it or is
> their better syntax to speed it up and still provide the same report
> results?:
> SELECT t1.MemberId, t1.PeriodID, t8.start_date, t6.amount_type_id,
> t6.amount_type,
> SUM(CASE WHEN t2.amountTypeId = 7 THEN t2.amount
> WHEN t2.amountTypeId = 23 THEN - t2.amount END) AS Purchase,
> SUM(CASE WHEN t2.amountTypeId = 8 THEN t2.amount
> WHEN t2.amountTypeId = 24 THEN - t2.amount END) AS Matrix,
> SUM(CASE WHEN t2.amountTypeId = 20 THEN t2.amount
> WHEN t2.amountTypeId = 21 THEN - t2.amount END) AS QualiFly,
> SUM(CASE WHEN t2.amountTypeId = 9 THEN t2.amount
> WHEN t2.amountTypeId = 25 THEN - t2.amount END) AS Dist,
> SUM(CASE WHEN t2.amountTypeId = 10 THEN t2.amount
> WHEN t2.amountTypeId = 26 THEN - t2.amount END) AS SM,
> SUM(CASE WHEN t2.amountTypeId = 11 THEN t2.amount
> WHEN t2.amountTypeId = 27 THEN - t2.amount END) AS BreakAway,
> SUM(CASE WHEN t2.amountTypeId = 13 THEN t2.amount
> WHEN t2.amountTypeId = 14 THEN - t2.amount END) AS Transfer,
> SUM(CASE WHEN t2.amountTypeId = 28 THEN t2.amount
> WHEN t2.amountTypeId = 15 THEN - t2.amount END) AS Spent
> FROM tblTravelDetail t1 INNER JOIN
> tblTravelDetailAmount t2 ON t1.TravelDetailId =
> t2.TravelDetailId INNER JOIN
> tblTravelDetail t3 ON t2.TravelDetailId =
> t3.TravelDetailId INNER JOIN
> tblTravelDetailMember t4 ON t3.TravelDetailId =
> t4.TravelDetailId INNER JOIN
> tblTravelEvent t5 ON t1.TravelEventId =
> t5.TravelEventId INNER JOIN
> amount_type t6 ON t2.amountTypeId =
> t6.amount_type_id INNER JOIN
> period t8 ON t1.PeriodID = t8.period_id
> WHERE (t1.MemberId = @.MemberId) AND (t2.amount <> 0)
> GROUP BY t1.MemberId, t1.PeriodID, t8.start_date, t6.amount_type_id,
> t6.amount_type
> Any help is appreciated.
> Thanks,
> Trint|||Thank you for your responses...Adding indexes to the tables made the
process faster.
Trint

Sunday, February 19, 2012

can i script subscriptions?

I have about 150 subscriptions to create on our Standard Edition of RS. Is
there a way for me to script these or create them programmatically? Your
help is greatly appreciated.Yes, use the rs.exe utility to call the SOAP API.
-Lukasz
This posting is provided "AS IS" with no warranties, and confers no rights.
"chicagoclone" <chicagoclone@.discussions.microsoft.com> wrote in message
news:9143BBF8-0632-41CA-838F-905854FC39B6@.microsoft.com...
>I have about 150 subscriptions to create on our Standard Edition of RS. Is
> there a way for me to script these or create them programmatically? Your
> help is greatly appreciated.