Showing posts with label studio. Show all posts
Showing posts with label studio. Show all posts

Thursday, March 29, 2012

create tables and insert data in sql server mobile on dekstop

Hello (sorry my bad english, im brazilian)

I was using Visual Studio 2003 and SQL Server CE 2.0 for C# mobile applications. The .sdf database were created in the emulator or in the mobile device itself using Query Analizer.

The application developed need some initial data to run, and this data is obtained executing one service that reads a postgree database, and insert the data in the SQL CE database of the mobile device. But, given the size of the database (maybe 10.000 rows), it tooks too much time (sometimes 6 hours).

Now we are migrating to Visual Studio 2005 and SQL Server 2005 Mobile Edition.

I want to know if its possible to create the .sdf database and load the data into this database on the desktop. Maybe through the execution of a .sql script, or through a service executed on the desktop.

After this, its just upload de .sdf file to the mobile device.

Thanks

Robson

Yes, you can create and populate your SQL Mobile database on the desktop as long as that desktop or server meets one of these criteria:

1. it contains a licensed copy of Visual Studio 2005

2. it contains a licesed copy of SQL Server 2005

3. it runs Windows XP Tablet PC edition

The code to do so is covered in the SQL Mobile Books Online.

There are other approaches as well, including third party tools like those at www.primeworks.pt, using SQL Server 2005 Integration Services, or creating and populating the database within SQL Server 2005 management studio.

-Darren

|||

Daren,

thanks for the help... I have found the way to create a sql server mobile 2005 database and insert data on the desktop using c# (running on desktop off course) at these forum topics:

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

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

I′ve used my licensed copy of Visual Studio 2005 to do it. Now I′ll test the solution to make a benchmark... I hope that now i will be able to create the database for my application faster....

thanks again...

|||

Please let us know how it works out for you.

Darren

|||

I have created the following table ('cidade' means city in portuguese):

CREATE TABLE cidade ( idcidade numeric(18,0) NOT NULL, codigo integer NOT NULL, descricao nvarchar(80) NOT NULL, ddd nvarchar(3), naturalidade nvarchar(80), idunidadefederativa numeric(18,0) NOT NULL )

The program (written in c# with visual studio 2005 and sql server 2005 mobile edition) insert 5565 rows in this table. It reads a sql insert line from a text file and execute the sql, eg:

INSERT INTO cidade VALUES (1, 1, 'ALTA FLORESTA D OESTE', NULL, NULL, 21)

It tooks 6 seconds to do it (running on a HP notebook with celeron processor).So, 927.5 rows per second.

Before, when we insert data on a database located at a pocket pc, this operation took 20 - 30 minutes (using c# compact framework from visual studio 2003 and sql ce 2.0).

|||

thanks for sharing your benchmark results - that's very good news.

-Darren

sql

Create Table with current date as part of the table name

Afternoon all,

Is it possible from within SQL Server Management Studio to create a table based upon an existing table using the current date as part of the table name?

I.E; SELECT * FROM TABLENAME INTO TABLENAMEWITHDATE - if this query was setup as a SSMS Agent Job we could create a daily snapshot of data in this table.

I've tried many times but always get an incorrect syntax message when I try to excecute the query. I'm not sure what syntax I should use to create the tablename with current date included?

Any help would be appreciated.

Thanks,

Chris

Though I am wary of what you are trying to do (a permanent table with a column fro the load date is usually easier to work with,) you could use dynamic SQL:

declare @.tableName varchar(8), @.query nvarchar(1000)

set @.tableName = convert(varchar(8), getdate(),112)

select @.query = 'select name into ' + quotename(@.tableName) + ' from sys.objects'

exec (@.query)

select *
from sys.objects
where name = @.tableName

|||

Thanks, Louis, you've been a great help.

If you ever find yourself lost in Chepstow I'll definately be buying your drinks.

Chris

sql

Create Table with current date as part of the table name

Afternoon all,

Is it possible from within SQL Server Management Studio to create a table based upon an existing table using the current date as part of the table name?

I.E; SELECT * FROM TABLENAME INTO TABLENAMEWITHDATE - if this query was setup as a SSMS Agent Job we could create a daily snapshot of data in this table.

I've tried many times but always get an incorrect syntax message when I try to excecute the query. I'm not sure what syntax I should use to create the tablename with current date included?

Any help would be appreciated.

Thanks,

Chris

Though I am wary of what you are trying to do (a permanent table with a column fro the load date is usually easier to work with,) you could use dynamic SQL:

declare @.tableName varchar(8), @.query nvarchar(1000)

set @.tableName = convert(varchar(8), getdate(),112)

select @.query = 'select name into ' + quotename(@.tableName) + ' from sys.objects'

exec (@.query)

select *
from sys.objects
where name = @.tableName

|||

Thanks, Louis, you've been a great help.

If you ever find yourself lost in Chepstow I'll definately be buying your drinks.

Chris

CREATE TABLE template, Management Studio Express

I accidentally overwrote the CREATE TABLE template in SQL Server Management Studio Express. Could someone please post the original template?

FYISmile

-- =========================================
-- Create table template
-- =========================================
USE <database, sysname, AdventureWorks>
GO

IF OBJECT_ID('<schema_name, sysname, dbo>.<table_name, sysname, sample_table>', 'U') IS NOT NULL
DROP TABLE <schema_name, sysname, dbo>.<table_name, sysname, sample_table>
GO

CREATE TABLE <schema_name, sysname, dbo>.<table_name, sysname, sample_table>
(
<columns_in_primary_key, , c1> <column1_datatype, , int> <column1_nullability,, NOT NULL>,
<column2_name, sysname, c2> <column2_datatype, , char(10)> <column2_nullability,, NULL>,
<column3_name, sysname, c3> <column3_datatype, , datetime> <column3_nullability,, NULL>,
CONSTRAINT <contraint_name, sysname, PK_sample_table> PRIMARY KEY (<columns_in_primary_key, , c1>)
)
GO

CREATE TABLE Template

I accidentally altered the CREATE TABLE template from SQL Server Management Studio Express. Now I don't have the original. Could somebody please post CREATE TABLE template.

-- =========================================

-- Create table template

-- =========================================

USE <database, sysname, AdventureWorks>

GO

IF OBJECT_ID('<schema_name, sysname, dbo>.<table_name, sysname, sample_table>', 'U') IS NOT NULL

DROP TABLE <schema_name, sysname, dbo>.<table_name, sysname, sample_table>

GO

CREATE TABLE <schema_name, sysname, dbo>.<table_name, sysname, sample_table>

(

<columns_in_primary_key, , c1> <column1_datatype, , int> <column1_nullability,, NOT NULL>,

<column2_name, sysname, c2> <column2_datatype, , char(10)> <column2_nullability,, NULL>,

<column3_name, sysname, c3> <column3_datatype, , datetime> <column3_nullability,, NULL>,

CONSTRAINT <contraint_name, sysname, PK_sample_table> PRIMARY KEY (<columns_in_primary_key, , c1>)

)

GO

|||

Or the simplified version:

Create Table MyTable(FirstField varchar(50), SecondField int)

or...

when in doubt >> Right Click in Management Studio to create a new table manually

Adamus

|||

Thanks, joeydj,

johncelmer

sql

CREATE TABLE scripts

I have a bunch of CREATE TABLE scripts I need to run.

In Visual Studio 2003 you could right-click on a .SQL file and choose Run from the shortcut menu... and it would run the script. Visual Studio 2005 there is not a Run on the right-click short cut menu.

What gives?

hi,

why not just downloading the free official management tool, SQL Server Management Studio Express, from http://www.microsoft.com/downloads/details.aspx?familyid=C243A5AE-4BD1-4E3D-94B8-5A0F62BF7796&displaylang=en ..

after installing it, the .Sql extension will be associated to this tool... very easy to use..

regards

|||

You should consider asking this question of the VS folks, they hang out over in the VS forums.

Mike

Tuesday, March 27, 2012

Create table in schema in Managment Studio

Hi all, if I create a new schema:
CREATE SCHEMA MySchema
it appears in Sql Server Management Studio's schema, but it's not
obvious to me how to create a new table (or other object) under this
schema, without using the CREATE TABLE statement. How can I create a
new table under this schema using the designed in Managment Studio?
This is Sql Server 2005 (Standard Edition) I'm using.
Thanks!
Richard
Hello, Richard
When you create a new table using Management Studio, choose "View /
Properties Window" (or press F4) and select the desired schema in the
combo for the "Schema" property (under the "(Identity)" category).
Razvan

Create table in schema in Managment Studio

Hi all, if I create a new schema:
CREATE SCHEMA MySchema
it appears in Sql Server Management Studio's schema, but it's not
obvious to me how to create a new table (or other object) under this
schema, without using the CREATE TABLE statement. How can I create a
new table under this schema using the designed in Managment Studio?
This is Sql Server 2005 (Standard Edition) I'm using.
Thanks!
RichardHello, Richard
When you create a new table using Management Studio, choose "View /
Properties Window" (or press F4) and select the desired schema in the
combo for the "Schema" property (under the "(Identity)" category).
Razvan

Create table in schema in Managment Studio

Hi all, if I create a new schema:
CREATE SCHEMA MySchema
it appears in Sql Server Management Studio's schema, but it's not
obvious to me how to create a new table (or other object) under this
schema, without using the CREATE TABLE statement. How can I create a
new table under this schema using the designed in Managment Studio?
This is Sql Server 2005 (Standard Edition) I'm using.
Thanks!
RichardHello, Richard
When you create a new table using Management Studio, choose "View /
Properties Window" (or press F4) and select the desired schema in the
combo for the "Schema" property (under the "(Identity)" category).
Razvan

Sunday, March 25, 2012

Create Table and Alter table:

Hi All,

I am using SQl server studio management to create table.

How to set two attributes as a primary key: composite key. like ( proj_id, emp id) both as primary key.

How to specify the forign key constraint. using alter table

Please give me the example: don't syntax which msdn gives.

Thanks and Regards

Abdul M.G

Hi,

Look at this.

1CREATE TABLE Menu2(3 MenuIdint,4 Titlevarchar(50),5 Urlvarchar(256),6 ParentIdintNULL7)89ALTER TABLE MenuADD CONSTRAINT MenuIdPRIMARY KEY1011ALTER TABLE MenuADD CONSTRAINT ParentIdREFERENCES Menu(MenuId)
sql

Thursday, March 22, 2012

CREATE SUBCUBE in Microsoft Visual Studio for SQL2005

Hi,

I am trying to create a SUBCUBE in Microsoft Visual Studio (Analysis Services) but

It keeps on giving me an error when trying to build the Subcube.

The MDX statement is correct because I have tested it in SQL2005 Management Studio and it works.

My question is that “am I doing it in the right place?”:

This is under the Cubes Folder > Calculations Tab> New Script Command

My understanding is that under the “New Script Command” I can type any MDX statement and it should work? Or should this be done in another place?

When processing the cube the error I am getting back is:

Parser: The script contains the statement, which is not allowed

What I am trying to do is to create a slice of a cube by e.g. Brand which one of my departments need to use and should not see the other Brands. All the other dimensions and measures should still apply.

I would appreciate it if someone can please assist me with this.

Thank you in advance

Pieter Nelson

im no expert in olap cubes and am only tinkering with them for the last few months, but ive never heard of sub cubes. in that suituation, id either use a front end to create a report that filters out all but the brand your interested in, or create a seperate cube, based on the exact same data source view, but just import the brand you require. there may be a more elegant way, but those ways are pretty simple.

Regards,

Winston.

|||

Hi Pieter,

It sounds like you need to be using dimension security, not subcubes here. See
http://msdn2.microsoft.com/en-us/library/ms175366.aspx

for details on how to do this.

HTH,

Chris

|||

Unfortuanately I can not use Security or Another Measure Group.

I went into the Calculations Tab in Visual Studio and edited the Calculate Script that look like this:

-

CALCULATE;

CREATE SUBCUBE [Cube_AcqMgmtGF_Mthly] AS SELECT

{[All Brands].[All Brands].[Brand].&[Goldfishka B]} ON 0

FROM [Cube_AcqMgmtGF_Mthly];

CREATE MEMBER CURRENTCUBE.[MEASURES].[Ave first Purchase]

AS '[Measures].[First Purch]/[Measures].[Usaccountno]',

FORMAT_STRING = "Currency",

VISIBLE = 1;

-

I am still trying to filter this cube to one specific brand, but the deployment keeps on failing with the following Description:

"An MDX Statement was expected. An MDX expression was specified" "The script contains the statement, which is not allowed"

To be honest here, I am now getting really confused.

SUMMARY:

Is my code in the right place "Create Subcube" or is there an alternative way of doing this.

PLEASE HELP ANYONE?

|||

Hi Pieter,

To be honest, I can't see anything wrong with your MDX (which service pack are you runnning?) but even if you could create a subcube in your MDX Script I don't think it's going to do what you want - even though I'm able to deploy a CREATE SUBCUBE command in an MDX Script it doesn't look like it does anything useful.

Why can't you use security or another measure group? Can you explain what you want to do in more detail?

Chris

|||

Hi,

I am trying to create subcubes(by Brands) from a Master cube (by only processing one cube), but the situation is that if I create a cube for every brand then it will be different processing for every cube. Unfortuanately these fact tables contains millions of records and processing all these records for every cube will take much longer. The other problem is that if there is changes in the logic of one fact table then I will have to apply these changes to all the other cubes individually.

Hope this helps?

|||

This sounds exactly what dimension security is intended for. Why do you say you can't use it?

Chris

Wednesday, March 21, 2012

Create SQL Server developer version database in app_data folder

Hi

I am trying to create a sql server database in the app_data folder of visual studio 2005. It keeps telling me I need the express version. Can I not use the developer version

Thanks

By default installation, SQL Server 2005 Developer version stores its databases' files in places like this (in my computer):C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data

The express version can save a data file in app_data folder to work with visual studio 2005 or VWD. You need different connection strings to access your database.

Here is a sample section of connection strings in a web.config file to access databases (developer version):

<connectionStrings>

<addname="MSDN_forumConnectionString"connectionString="Data Source=localhost;Initial Catalog=MSDN_forum;Integrated Security=True"

providerName="System.Data.SqlClient" />

<addname="NorthwindConnectionString"connectionString="Data Source=(local);Initial Catalog=Northwind;Integrated Security=True"

providerName="System.Data.SqlClient" />

</connectionStrings>

|||

Hi

Thankyou for your response. I have no problem connecting to a sql server deveoper version . The problem I have is when I right click app_data foler and add new item & choose databse I get the following error

Connections to SQL Server files (*.mdf) require SQL Server Express 2005 to function properly.

I dont want to use the Express version but the developer version. Hope this make it a bit more clear

Thanks

|||

Hi,

Just as Limno said, if you want to create your database in app_data folder of Visual Studio 2005, you have to install the SQL Server Express edition because other editions of SQL Server does not support attaching database files automatically at runtime.

Thanks.

|||

Many thanks for your answer. I have now installed sql server express

Create script in 2005 without the [] delimiters around the object names

Anyone know how to permanently set up SQL 2005 Server Management Studio to NOT put those silly [ and ] delimiters around object names when using the CREATE SCRIPT to... funtionality from object explorer?

Moving thread to the Tools General forum because they'll be better able to answer your question.

-Jeffrey

Monday, March 19, 2012

Create reporting services project in VS 2003

I've installed instance of SQL Server 2005 with reporting services on
my Windows 2003
computer .I've had Visual studio 2003 .After installation i can't
create new reporting
service project in my VS 2003 IDE,but i have now VS 2005 with only
reporting services
project types evalible.I need to work on reporting services in VS
2003.Please tell me how
can i do this.
ThanksHi,
I dont think it is possible in VS 2003. If you have installed Sql server
2005 and their tools you can go through "SQL Server Business Intelligent
studio" you can do report creation.
Regards
Amarnath
"gbletel@.gmail.com" wrote:
> I've installed instance of SQL Server 2005 with reporting services on
> my Windows 2003
> computer .I've had Visual studio 2003 .After installation i can't
> create new reporting
> service project in my VS 2003 IDE,but i have now VS 2005 with only
> reporting services
> project types evalible.I need to work on reporting services in VS
> 2003.Please tell me how
> can i do this.
> Thanks
>

Sunday, March 11, 2012

Create Package in SQL Server Management Studio Express?

Our server currently has the following components installed for SQL Server 2005: 1. SQL Server Management Studio Express and 2. Configuration Tools (SQL Server Configuration Manager, SQL Server Error and Usage Reporting, and SQL Server Service Area Configuration).

Is there a way to setup a package using the software currently installed (if not, what needs to be installed in order to setup a package)?

I'm looking to schedule running an executible, it was fairly easy with SQL Server 2000 (using DTS), but I'm unsure how to set this up using the software we currently have installed.

It looks like you are using SQL Sever 2005 express?

Sorry but SSIS doesn't come with express, you'll need Standard edition or better:

see the section, "Integration and Interoperability":

http://www.microsoft.com/sql/prodinfo/features/compare-features.mspx

|||P.S. Installing standard edition tools seems to do the trick (be sure to install Integration Services).

Thursday, March 8, 2012

Create new schema using management studio

instead of CREATE SCHEMA using T-SQL

Open the database node > Your Database > Security > Schemas (be sure that your database is a SQL Server 2005 database)

Jens K. Suessmeyer

http://www.sqlserver2005.de

Wednesday, March 7, 2012

Create Maintenance Plans on SQL2K and SQL2005 w/SQL Mgmt. Studio?

I don't see any way to run the Maintenance Plan wizard against my existing SQL2K or SQL2005 DBs using the MS SQL Maintenance Studio. I read in another thread about having to install SSIS, and I think I have that on the SQL2005, but how is it done against the SQL2K DBs? I have dug around in the Mgmt Studio to no avail. If this thing is not fully backward compatible, then in addition to being slow as an old dog on a 2.5Ghz computer, then I really think MS has not demonstrated how cool this .NET stuff can be (or have they). What a sink for CPU cycles.

Do you have SQL 2000 server tools installed as a seperate instance, if so why not schedule with this server instance.

True that you have to use SSIS in order to run the maintenance plan and schedule that a seperate job, refer to the books online for more information in this regard.

|||

Yes, I do have the SQL 2000 Enterprise Manager installed, but I was trying to transition to a single set of tools to manage all my servers. One would think that MS would support fully the next most recent version.

What would be the way to verify if the SSIS is installed on a specific server?

Create login problem in SQL Server 2005

Hey guys,

I'm having a problem making a new login inside the sql management studio, the problem is, when i create a new login, i selected SQL Authentication, then type a password, then uncheck Enforce password policy.

i then select the database i want the login to be associated with, but once i click ok i get this exception:
Create failed for Login ''. (Microsoft.SqlServer.Smo)

An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
"An object or column name is missing or empty. For SELECT INTO statements, verify each column has a name. For other statements, look for empty alias names. Aliases defined as "" or [] are not allowed. Add a name or single space as the alias name. (Microsoft SQL Server, Error: 1038)

I even tried with Northwind and a brand new database with a table and 2 columns but it's the same story every time.
Any ideas?

Thanks a bunchMake sure you have entered "Login Name" in the text box provided at the top of the window

thanks
Anoop

Friday, February 24, 2012

Create folders in Object Explorer - wish...

Here's one thing that I'd like to see come out in some version of the SQL Server Management Studio...

The ability to create folders under the database node so that databases can be grouped on one server.

We have over 100 databases on our development server and these are created by a range of consultants and developers and even support staff as needed.

Being able to group the databases by product, etc would be a nice touch since we have client databases that don't fit naming conventions etc.

Multiple instances are another way around this but are expensive and resource hungry - we develop and support models, not use them for transactions too much.

Yes there are 'better' ways such as setting security correctly but we are too busy working and not maintaining.

Folders or database groups would be a nice touch.

Cheers

I encourage you to offer the suggestion here, and to encourage others so inclined to 'vote' for it. (Enhancement suggestions run somewhat like a popularity contest.

Suggestions for SQL Server

http://connect.microsoft.com/sqlserver

CREATE FILE access denied

I get this error message when trying to create a database. This happens from
the Management Studio, from regular queries, etc. No other posts seem to
resolve this problem exactly that I can find. Thanks for any insight into
this problem...
USE MASTER
CREATE DATABASE XYZ
ON (Name = XYZ_data, FILENAME='C:\\XYZ_data.mdf')
LOG ON (Name = XYZ_log, FILENAME='C:\\XYZ_log.ldf')
Error message:
Msg 1802, Level 16, State 4, Line 2
CREATE DATABASE failed. Some file names listed could not be created. Check
related errors.
Msg 5123, Level 16, State 1, Line 2
CREATE FILE encountered operating system error 5(Access is denied.) while
attempting to open or create the physical file 'c:\XYZ_data.mdf'.
Hi
Check that the account that SQL Server runs under has file system
permissions on c:\
OS Error 5 = access denied.
Regards
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"XCode247" <XCode247@.discussions.microsoft.com> wrote in message
news:7DE6CBB0-087A-4CD2-9B45-AEAE45532C06@.microsoft.com...
>I get this error message when trying to create a database. This happens
>from
> the Management Studio, from regular queries, etc. No other posts seem to
> resolve this problem exactly that I can find. Thanks for any insight into
> this problem...
> USE MASTER
> CREATE DATABASE XYZ
> ON (Name = XYZ_data, FILENAME='C:\\XYZ_data.mdf')
> LOG ON (Name = XYZ_log, FILENAME='C:\\XYZ_log.ldf')
> Error message:
> Msg 1802, Level 16, State 4, Line 2
> CREATE DATABASE failed. Some file names listed could not be created. Check
> related errors.
> Msg 5123, Level 16, State 1, Line 2
> CREATE FILE encountered operating system error 5(Access is denied.) while
> attempting to open or create the physical file 'c:\XYZ_data.mdf'.
>
|||Yes, sure enough...
In Configuration Manager, Service properties. The 'Log on as' account was
'Network Service'. The help button from that page says a 'domain user account
with minimal rights' is recommended. Changing the account causes it to work.