Showing posts with label sample. Show all posts
Showing posts with label sample. Show all posts

Sunday, March 11, 2012

Create Partition using ASSL

Hi,

Is there any sample code about create partition using ASSL (Analysis Service Script Language)?

thanks,

There is no ASSL. There is a DDL - data definition language for Analysis Services objects.

It is XML-based. Try in the SQL Managment Studio to right click on your partition and script it into the XMLA editor. You will see DDL definition of the partition. You can modify it, change the partition ID and name and send back to the server. You will see new partition being created as result of that.

Thanks.
Edward

This posting is provided "AS IS" with no warranties, and confers no rights

|||thanks a lot. :)

Thursday, March 8, 2012

create NorthWind Sample Database

hi
i have the instnwnd.sql with the structure of NorthWind Sample Database. How
can i import it?
The original database was deleted.
thx
Use OSQL and specify the file name using the /i parameter.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
"msnews.microsoft.com" <visperas1@.hotmail.com> wrote in message news:uE9kYeAOEHA.1456@.TK2MSFTNGP09.phx.gbl...
> hi
> i have the instnwnd.sql with the structure of NorthWind Sample Database. How
> can i import it?
> The original database was deleted.
> thx
>
|||Use osql or open the file in Query analyzer (isqlw) and run the .sql file
using F5.
HTH,
Vinod Kumar
MCSE, DBA, MCAD, MCSD
http://www.extremeexperts.com
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
"msnews.microsoft.com" <visperas1@.hotmail.com> wrote in message
news:uE9kYeAOEHA.1456@.TK2MSFTNGP09.phx.gbl...
> hi
> i have the instnwnd.sql with the structure of NorthWind Sample Database.
How
> can i import it?
> The original database was deleted.
> thx
>
|||Alternately, there is a free (for personal use) tool at our site (MSDE
Manager) that you can use for this and other management options. Hope you
find it useful.
HTH,
Greg Low (MVP)
MSDE Manager SQL Tools
www.whitebearconsulting.com
"Vinodk" <vinodk_sct@.NO_SPAM_hotmail.com> wrote in message
news:%23LMH1nBOEHA.268@.TK2MSFTNGP11.phx.gbl...
> Use osql or open the file in Query analyzer (isqlw) and run the .sql file
> using F5.
> --
> HTH,
> Vinod Kumar
> MCSE, DBA, MCAD, MCSD
> http://www.extremeexperts.com
> Books Online for SQL Server SP3 at
> http://www.microsoft.com/sql/techinf...2000/books.asp
>
> "msnews.microsoft.com" <visperas1@.hotmail.com> wrote in message
> news:uE9kYeAOEHA.1456@.TK2MSFTNGP09.phx.gbl...
> How
>

Wednesday, March 7, 2012

Create merge publication programically?

Hi all,
Can any one give me a sample code for creating merge publication?
Thank you very much!
TonyHere is a snippet of code that I got after creating my publication in SQL Server Enterprise Manager, then had it generate the scripts for me. This is for a merge replication with dynamic filters (table filtered based on their username) and anonymous pull subscriptions allowed. Note: This does NOT create the first snapshot, as it doesn't create the code for this...but I'm sure it exists.

The best way to get this code is to do all you want in EM first, then export it and use it in your code. Good luck...replication is a pain.

-- Enabling the replication database
use master
GO

exec sp_replicationdboption N'MyDatabase', N'merge publish', true
GO

use [MyDatabase]
GO

-- Adding the merge publication
exec sp_addmergepublication @.publication = N'MyDatabase-MyPublication', @.description = N'Merge publication of MyDatabase database from Publisher MyServer.', @.retention = 60, @.sync_mode = N'character', @.allow_push = N'true', @.allow_pull = N'true', @.allow_anonymous = N'true', @.enabled_for_internet = N'false', @.centralized_conflicts = N'true', @.dynamic_filters = N'true'
exec sp_addpublication_snapshot @.publication = N'MyDatabase-MyPublication',@.frequency_type = 4, @.frequency_interval = 1, @.frequency_relative_interval = 1, @.frequency_recurrence_factor = 0, @.frequency_subday = 1, @.frequency_subday_interval = 5, @.active_start_date = 0, @.active_end_date = 0, @.active_start_time_of_day = 500, @.active_end_time_of_day = 235959
GO

exec sp_grant_publication_access @.publication = N'MyDatabase-MyPublication', @.login = N'sa'
GO
exec sp_grant_publication_access @.publication = N'MyDatabase-MyPublication', @.login = N'kellera'
GO

-- Adding the merge articles
exec sp_addmergearticle @.publication = N'MyDatabase-Master_Table', @.article = N'Master_People_Table', @.source_owner = N'dbo', @.source_object = N'Master_People_Table', @.type = N'table', @.description = null, @.column_tracking = N'true', @.pre_creation_cmd = N'drop', @.creation_script = null, @.schema_option = 0x00000000000000F1, @.article_resolver = null, @.subset_filterclause = N'vchUID=USER_NAME()'
GO

exec sp_addmergearticle @.publication = N'MyDatabase-MyPublication', @.article = N'Master_Table', @.source_owner = N'dbo', @.source_object = N'Master_Table', @.type = N'table', @.description = null, @.column_tracking = N'true', @.pre_creation_cmd = N'drop', @.creation_script = null, @.schema_option = 0x00000000000000F1, @.article_resolver = null, @.subset_filterclause = N'dtExpiration >= GETDATE()'
GO

-- Adding the article subset filter
exec sp_addmergefilter @.publication = N'MyDatabase-MyPublication', @.article = N'Master_Table', @.filtername = N'Master_Table_Master_People_Table', @.join_articlename = N'Master_People_Table', @.join_filterclause = N'Master_Table.Installer=Master_People_Table.iPers onID AND Master_People_Table.vchCategory LIKE ''Installer''', @.join_unique_key = 0
GO

Create Linked Report method

Does anyone have a sample of a CreateLinkedReport method they are using? I am using Reporting Services 2005 and Visual Basic 2005. I need the VB code and how I need to call it. I'd like to change one parameter, and then send it to select recipients using a specified schedule.

Thanks, Iris

Is there anything wrong with the BOL sample code?|||

I'll try that example.

Also, when I try to click Create Linked Report from a master report that I created, I get an internal error. In SS SP2, it shows that this problem was fixed. When I installed SP2 today, it did not fix the problem. I am using a Stored Procedure with one parameter of int value.

Any ideas?

Thanks, Iris

Friday, February 24, 2012

Create full sql script from existing mdf

Hi,

In most books on ADO.NET programming, a sample database is given as a series of sql instructions (create database, create table, insert into table values (..), etc ), thereby creating the complete mdf/database file. The question arises: how does one create such a SQL script file from an existing .mdf using SSMSEE/SQL Server 2005 Express?

Cheers,

Daniel

Take a look at this thread

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=320987&SiteID=1

|||

Or just use “generate scripts wizard”:

Right-click on the database,

choose “TASKS-> Generate Scripts” and simply follow the wizard steps.

Regards,

Alfred.

Create full sql script from existing mdf

Hi,

In most books on ADO.NET programming, a sample database is given as a series of sql instructions (create database, create table, insert into table values (..), etc ), thereby creating the complete mdf/database file. The question arises: how does one create such a SQL script file from an existing .mdf using SSMSEE/SQL Server 2005 Express?

Cheers,

Daniel

Take a look at this thread

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=320987&SiteID=1

|||

Or just use “generate scripts wizard”:

Right-click on the database,

choose “TASKS-> Generate Scripts” and simply follow the wizard steps.

Regards,

Alfred.

Tuesday, February 14, 2012

create database at shared hoster site

I have an sql script that I ran on my local system using osql. It
created all the tables, views, and even inserted sample data into the
tables.

Now I need to create that same database on a shared hoster site. Only
the hoster does not allow the running of osql.

How can I create my sql server database on my shared hoster site?

Can I save and restore my database somehow?

Is there a stored procedure I can run which will run the .sql script
file?

thanks,

-SteveThat depends on how your provider expects you to execute SQL code - if
they don't allow osql.exe, then what do they allow? And how do you
connect to the hosted database - do you use Enterprise Manager? Since
osql.exe is just a client application, if you can connect to the SQL
server then you should be able to use it.

Simon|||Simon Hayes wrote:
> That depends on how your provider expects you to execute SQL code -
if
> they don't allow osql.exe, then what do they allow?

the hoster is godaddy.com You do get a panel where you can manually
config the database. There is something called "Query Analyser" which
provides a window to run sql statements. I dont think this is the same
as the Microsoft Query Analyzer that I read about yesterday. In this
godaddy qa window I cannot "run sqlscript.sql" like I think you can do
in Microsoft Query Analyzer.

What I was able to do was cut and paste large sections of my script.sql
from my PC editor into the GoDaddy "Query Analyser" window. Then I
clicked the "submit" button and it basically worked.

> And how do you
> connect to the hosted database - do you use Enterprise Manager?

> Since
> osql.exe is just a client application, if you can connect to the SQL
> server then you should be able to use it.

well my asp.net code can use the SqlConnection class to connect to the
database, then use SqlCommand to run SQL commands. Can osql be run in
that context?

I am curious to know if there is a stored procedure I can use which
will run an .sql script.

thanks,

-Steve|||You might be able to re-use this code in ASP:

http://groups-beta.google.com/group...e72b5441b?hl=en

A web interface which doesn't allow uploading scripts is quite limited
- I would definitely ask the provider if they can enhance it.

There's no stored proc to run a file, probably because the server would
need to have access to the script file somehow, which is tricky if it's
on your workstation. It's common to use xp_cmdshell to call osql.exe as
a way of executing scripts, but that's only really useful for syadmins,
because of the security implications.

Simon|||Simon Hayes wrote:
> You might be able to re-use this code in ASP:
>
http://groups-beta.google.com/group...e72b5441b?hl=en

that looks to be exactly what I am looking for.

thanks very much,

-Steve

> A web interface which doesn't allow uploading scripts is quite
limited
> - I would definitely ask the provider if they can enhance it.
> There's no stored proc to run a file, probably because the server
would
> need to have access to the script file somehow, which is tricky if
it's
> on your workstation. It's common to use xp_cmdshell to call osql.exe
as
> a way of executing scripts, but that's only really useful for
syadmins,
> because of the security implications.
> Simon