FILENAME Option In CREATE DATABASE Statement

Nov 9, 2004

Hi,





I have a problem with CREATE DATABASE statement, since it needs to specify the absolut path for a file in the FILENAME= option. I would need instead a relative path, i.e. only the name of the file because the script that launch this SQL command is dependant on the installation path decided by the user, during the installation.


Is there a way to pass to the FILENAME only the name of the file?


Hope to have been clear :-)





Thanks in advance

View 4 Replies


ADVERTISEMENT

Using OPTION Clause Within CREATE FUNCTION Statement For Inline Table Functions

May 13, 2008

Hi!

I need to expand resursion level for resursive CTE expression within CREATE FUNCTION statement for inline table function to a value greater than default. It turns out that OPTION clause for MAXRECURSION hint perfectly works if I use it outside CREATE FUNCTION (as well as CREATE VIEW for non-parametrized queries), but it does not within CREATE FUNCTION statement - I'm getting error:

Msg 156, Level 15, State 1, Procedure ExpandedCTE, Line 34

Incorrect syntax near the keyword 'option'.

Here is the function:


create FUNCTION [dbo].[ExpandedCTE]

(

@p_id int

)

RETURNS TABLE

AS

RETURN

(

with tbl_cte (id, tbl_id, lvl)

as

(

select


id, tbl_id, 0 lvl

from


tbl

where


id = @p_id

union all

select


t.id, t.tbl_id, lvl + 1
from

tbl_cte
inner join tbl t


on rnr.tbl_id = tbl_cte.id

)

select


id, tbl_id, lvl

from


tbl_cte

option (maxrecursion 0)

)


Please help!

Alexander.


P.S.
I'm really sorry if it is about syntax, but I could not find it in the documentation.

View 12 Replies View Related

Database Filename Error -- Cannot Create Db From MS Online Tutorials

Apr 20, 2006

I am using VB with Visual Studio Express.  I am new to these tools.  I have SQL Server 2005 Express installed on my machine.  I think that I have the right version.  I am just using Express for taking classes and teaching myself on my machine.
When I follow the examples in the book, I keep getting this error when I go to my ASP.NET configuration and click on the security tab to add myself as a user.
"There is a problem with your selected data store. This can be caused by an invalid server name or credentials, or by insufficient permission. It can also be caused by the role manager feature not being enabled. Click the button below to be redirected to a page where you can choose a new data store. The following message may help in diagnosing the problem: The database filename can not contain the following 3 characters: [ (open square brace), ] (close square brace) and ' (single quote) "   -- end of erro msg.
I have an apostrophe in my last name.  Could that be what is causing it?  Is it creating a db based on my name or something?  Or do I have the wrong version of SQL Server Express installed.
Thank you for any help.  I appreciate it.
 
--Mark

View 1 Replies View Related

CREATE DATABASE Script Doesn't Accept A Variable For A FILENAME

May 2, 2007

I want to create a SP that creates a new database, so I script-ed out the db and paste the script into new SP gui (SQL 2000). I want to pass it a variable for the data/log file location that is not the default location. The original script looks like this:
CREATE DATABASE [PWRR_DDS]  ON (NAME = N'PWRR_DDS_Data', FILENAME = N'F:SQL SERVER FILESDatabasesdbName.mdf' , SIZE = 3118, FILEGROWTH = 10%) LOG ON (NAME = N'PWRR_DDS_Log', FILENAME = N'F:SQL SERVER FILESDatabasesdbName_Log.LDF' , SIZE = 5000, FILEGROWTH = 10%)  COLLATE SQL_Latin1_General_CP1_CI_AS.
I replaced the path of the FILENAME variable like this:
CREATE DATABASE [PWRR_DDS]  ON (NAME = N'PWRR_DDS_Data', FILENAME = @DBPath, SIZE = 5000, FILEGROWTH = 10%) LOG ON (NAME = N'PWRR_DDS_Log', FILENAME = @LogPath , SIZE = 5000, FILEGROWTH = 10%) COLLATE SQL_Latin1_General_CP1_CI_AS,
declaring the variables as char(500). The error I get is "Incorrect sybtax near '@DBPath'.
Any ideas for workaround?
Thanks,
EJM

View 1 Replies View Related

How To Enable The Option Of Create New SQL Server Database From Database Explorer

Nov 10, 2006

Hi there

I am working on Visual Web Developer Express Edition 2005. When I right click on database explorer to create an SQL server database then I always find the option " Create New SQL Server database " Disabled.

Can any one tell me how to enable that option please ?

View 4 Replies View Related

SQL 2012 :: Configuring Memory Per Query Option And Index Create Memory Option

Feb 10, 2015

So I started a new job recently and have noticed a few strange configurations. Typically I would never mess with min memory per query option and index create memory option configuration because i just haven't seen any need to. My typical thought is that if it isn't broke... They have been modified on every single server in my environment.

From Books Online:
• This option is an advanced option and should be changed only by an experienced database administrator or certified SQL Server technician.
• The index create memory option is self-configuring and usually works without requiring adjustment. However, if you experience difficulties creating indexes, consider increasing the value of this option from its run value.

View 3 Replies View Related

How To Concatenate Variables For RAW Output Filename I.e.@path + @filename?

Sep 7, 2007

Doesn't appear you can do this.

Am I wrong?

Please tell me I am.

View 11 Replies View Related

Select More Than Two Option In SQL Statement

Nov 9, 2004

hi, is there any way to select more than two option in the select case sql statement?

i try the sql below, but it give me an error 'Incorrect syntax near the keyword 'if'.'

Thanks in advance.


(SELECT stay = CASE WHEN stay >= 10 THEN '10 stay' ELSE if stay >7 then '7 - 9 stay' else 'no stay' END) AS stay

View 2 Replies View Related

How Can I Create A Pipe-Delimited Export Option?

Jul 17, 2007

i've read that it's possible and this is what i entered in my rsreportserver.config file.

<Extension Name="PIPE" Type="Microsoft.ReportingServices.Rendering.CsvRenderer.CsvReport,Microsoft.ReportingServices.CsvRendering"/>
<OVerrideNames>
<Name Language="en-US">PIPE Delimited CSV</Name>
</OverrideNames>
<Configuration>
<DeviceInfo>
<FieldDelimiter>"%7C"</FieldDelimiter>
</DeviceInfo>
</COnfiguration>
</Extension>

I'm following the directions of the guide and it seems to crash my report server. can you help out? thanks in advance.

View 6 Replies View Related

SQL 2012 :: Create Linked Server With Failover Partner Option?

Jul 22, 2014

it is possible to create Linked server with Failover partner option. I can query when primary server and getting the error when I set the DB Fail over. I have tried with following script and also gone through different sources, but failed. Please see the script and error below.

EXEC master.dbo.sp_addlinkedserver
@server = N'MIRRORLink',
@srvproduct=N'',
@provider=N'SQLOLEDB',
@provstr=N'Server=primary;FailoverPartner=mirror;network=dbmssocn;',

[code].....

View 2 Replies View Related

The Database Filename Can Not Contain The Following 3 Characters: [ ] And '

Aug 3, 2006

How do I correct this error: 
"The database filename can not contain the following 3 characters: [ (open square brace), ] (close square brace) and ' (single quote)" ?
Where is the database stored and/or how can I change the relevant settings?
I have Both Visual Web Developer Express and SQL server express.
Exception detail:
System.Web.HttpException was unhandled by user code  Message="The database filename can not contain the following 3 characters: [ (open square brace), ] (close square brace) and ' (single quote)"  Source="System.Web"  ErrorCode=-2147467259  StackTrace:       at System.Web.DataAccess.SqlConnectionHelper.CreateMdfFile(String fullFileName, String dataDir, String connectionString)       at System.Web.DataAccess.SqlConnectionHelper.EnsureSqlExpressDBFile(String connectionString)       at System.Web.DataAccess.SqlConnectionHelper.GetConnection(String connectionString, Boolean revertImpersonation)       at System.Web.Profile.SqlProfileProvider.GetPropertyValuesFromDatabase(String userName, SettingsPropertyValueCollection svc)       at System.Web.Profile.SqlProfileProvider.GetPropertyValues(SettingsContext sc, SettingsPropertyCollection properties)       at System.Configuration.SettingsBase.GetPropertiesFromProvider(SettingsProvider provider)       at System.Configuration.SettingsBase.SetPropertyValueByName(String propertyName, Object propertyValue)       at System.Configuration.SettingsBase.set_Item(String propertyName, Object value)       at System.Web.Profile.ProfileBase.SetInternal(String propertyName, Object value)       at System.Web.Profile.ProfileBase.set_Item(String propertyName, Object value)       at System.Web.Profile.ProfileBase.SetPropertyValue(String propertyName, Object propertyValue)       at ProfileCommon.set_MyNewProperty(String value) in c:WINDOWSMicrosoft.NETFrameworkv2.0.50727Temporary ASP.NET Fileslesson04385e3cebf08b8b90App_Code.jqcpv0qn.0.cs:line 24       at _Default.Page_Load(Object sender, EventArgs e) in D:Daniel's DocumentsVisual Studio 2005WebSitesLesson04Default.aspx.vb:line 15       at System.Web.UI.Control.OnLoad(EventArgs e)       at System.Web.UI.Control.LoadRecursive()       at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Thanks in advance
 

View 3 Replies View Related

Store A Filename In A Database

Dec 13, 2006

how can I  store a filename in the database, i have some GIF files which i want to show up on report, how can i specify those filename with a path in the database.
i tried manually entering the path c:Dataimages.gif but it didnt work. Can someone pls tell me how to do it.
 
Regards,
Karen

View 5 Replies View Related

Inserting Filename Into Database

Mar 7, 2008

I have a page called 'upload.vb', which is the code for a file upload project I am working on.  I am trying to write the filenames to an SQL database that I have built, but I keep getting this error: Compiler Error Message: BC30201: Expression expected. It doesn't seem to like the @ on line 46 in the VALUES part of my INSERT statement. Can anybody shed any light on this. Thanks.  1 Imports System
2 Imports System.Data
3 Imports System.Configuration
4 Imports System.Web
5 Imports System.Web.Security
6 Imports System.Web.UI
7 Imports System.Web.UI.WebControls
8 Imports System.Web.UI.WebControls.WebParts
9 Imports System.Web.UI.HtmlControls
10 Imports System.IO
11 Imports System.Data.SqlClient
12
13 ''' <summary>
14 ''' Upload handler for uploading files.
15 ''' </summary>
16 Public Class Upload
17 Implements IHttpHandler, IReadOnlySessionState
18
19 Public Sub New()
20 End Sub
21
22 #Region "IHttpHandler Members"
23
24 Public ReadOnly Property IsReusable() As Boolean Implements System.Web.IHttpHandler.IsReusable
25 Get
26 Return True
27 End Get
28 End Property
29
30
31
32 Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
33
34 If context.Request.Files.Count > 0 Then
35 ' get the applications path
36 Dim tempFile As String = context.Request.PhysicalApplicationPath
37 ' loop through all the uploaded files
38 Dim j As Integer = 0
39 While j < context.Request.Files.Count
40 ' get the current file
41 Dim uploadFile As HttpPostedFile = context.Request.Files(j)
42 ' if there was a file uploded
43 If uploadFile.ContentLength > 0 Then
44
45 uploadFile.SaveAs(String.Format("{0}{1}{2}", tempFile, "Uploads", uploadFile.FileName))
46 SqlDataSource.InsertCommand = "INSERT INTO tblDocuments(TheFileName) VALUES ('" & @TheFileName & "')"
47
48 End If
49 System.Math.Max(System.Threading.Interlocked.Increment(j), j - 1)
50 End While
51 End If
52 ' Used as a fix for a bug in mac flash player that makes the
53 ' onComplete event not fire
54 HttpContext.Current.Response.Write(" ")
55 End Sub
56 #End Region
57
58 End Class
    

View 10 Replies View Related

Transact SQL :: Placement Of Option (Recompile) In Dynamic For XML Select Statement?

Apr 18, 2015

I can't seem to place the "option (recompile)" in any valid position so that the following procedure executes without a syntax error .

USE [PO]
GO
/****** Object: StoredProcedure [dbo].[npSSUserLoad] Script Date: 4/18/2015 3:57:38 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON

[Code] ...

-- Generated code - DO NOT MODIFY

-- From Object Schema: 'C:XXXXXX.NetPOPOModel\_ObjectSchema

-- To regenerate this procedure use the 'Open With' option on file _ObjectSchema and select POCodeGen.exe

Declare @SqlCmd nvarchar(max)
Declare @ParamDefinitions nvarchar(1024)
Set @ParamDefinitions = N'@UserId int,NTUser varchar(30), @XmlResult XML OUTPUT'
Set @SqlCmd = N'Set @XmlResult =
(
Select
[UserId] [a],
[UserName] [b],

[code]....

View 7 Replies View Related

SSIS Execution Error: FlatFile Connection Problem - FileName &&<fileName&&> Specified In The Connection Was Not Valid.

Apr 19, 2008



Hi Champs,

Scenario Configuration : VB.net 2005 Code, WebService for Executing SSIS on Server, SSIS deployed on the Database Server

Problem Description : We are developing windows applicaiton in which we call webservice which was deployed on the same server where SSIS packages are deployed.
Now from Code we are passing FilePath name in variable and execute the Package. But the SSis result says that
The file name "\computernamefol1fol2fol3fol4abc.txt" specified in the connection was not valid.

More Information:

1. Full Permission are given on this network folder.
2. Package executes successfully from SSIS development solution (BIS solution)
3. Deployed packed executes successfully from the Database Server.
4. From Development pc packege executes successfully.
5. Other packages deployed on the same server executed suucessfully with same configuration and scenario.

Only this package is not executing.


-- the only differece with this package with other is -

using ".txt" extension in Flat file connection and using VB Script task


Can any one suggest the appropirate solution for this problem...

Thanks
Tarang Pandya

View 21 Replies View Related

I Do Not Have The Option To Create An Integration Service Project In Business Management Studio

Jun 13, 2007

Hi,



I have installed the advanced toolkit for Microsoft Sql server 2005, with the SQL server Business Intelligence Development Studio but I don't have the option the create a Integration Service project. I only have the Report Server project option available.



Do I have to download something else to get it?



I do not have a SQL server instance installed on the machine I installed the toolkit on.



Thank you

View 4 Replies View Related

Database Restore - Logical Filename

Apr 10, 2001

Hello All,

I am facing problem with Logical File Name while restoring database. I am taking a backup of ABC database from Server1 in abc.bak file.

Then I am creating new database XYZ on Server2. Server1 and Server2 are not connected to each other in anyway, since both servers belong to different companies. Here on Server2 I want to restore backup of abc.bak on XYZ database. I select restore from Device, and on option tab I am selecting Force restore over existing database, in the below option I am specifying current Data & log file path for Move to physical file name.
But Logical file name shows ABC names, but if I tried to change those to XYZ names then restore fails. But if I keep ABC names then it works.

Is anybody knows how to over come this Logical Name issue?

Many thanks in advance….

Regards,
Santosh

View 1 Replies View Related

Use A DTS Package To Create An Excel, Which Has In The Filename The Date The Package Is Ran

Dec 19, 2006

I am trying to create a DTS Package which will run a SQL query and export the results to an Excel file.  I would like to the name of the excel to be "dynamic".  What I would like is for the name to be ChronicDownSiteReport - mmddyy.xls.  The mmddyy is the date which the package is executed.
 How can I do this? 
Also, I want this package to be excuted at 1am every Sunday Morning.  I have attempted to schedule this to run, but when I come to work on Monday, the excel file is not present and the email, which is sent telling me that the file was created is not in my mailbox. 

View 2 Replies View Related

SQL 2012 :: Renaming Logical Filename Of A Database?

Mar 27, 2015

If I run an ALTER DATABASE command that renames the Logical file name of a database, will I run into any unseen consequences in terms of day to day use of the database?

View 4 Replies View Related

SQL Server 2012 :: Create Dynamic Update Statement Based On Return Values In Select Statement

Jan 9, 2015

Ok I have a query "SELECT ColumnNames FROM tbl1" let's say the values returned are "age,sex,race".

Now I want to be able to create an "update" statement like "UPATE tbl2 SET Col2 = age + sex + race" dynamically and execute this UPDATE statement. So, if the next select statement returns "age, sex, race, gender" then the script should create "UPDATE tbl2 SET Col2 = age + sex + race + gender" and execute it.

View 4 Replies View Related

File Filename.mdf Is On A Network Device Not Supported For Database Files

Nov 10, 2007



I am trying to attach to aMDF and LDF file that are on the remote location. When you try to do this though getting an error..
"File filename.mdf is on a network device not supported for database files."
How to do this.


Could you please help me to sort out this problem.

Thanks in advance

WillSmith
mail2willsmith@yahoo.com

View 3 Replies View Related

Cant Create New Database / CREATE DATABASE Permission Denied In Database Master (error 262)

Oct 2, 2007

 
 I am using SQL express and Visual web developer on windows Vista.
When I try to create a new database the following message appears.
 
CREATE DATABASE permission denied in database master (error 262)
I log on to my computer as an administrator.
Help appreciated
 Prontonet
 
 
 

View 4 Replies View Related

In SqlServer Management Studio Express, Server Type Option Is Greyed Out, Also Publication Option Missing

Apr 27, 2008

Hi everyone In my SqlServer Management Studio Express, on start up it shows the server type option, but greyed.So that value is fixed to database engine. ( I'm trying to work on an SqlServer Compact Edition database through the SSMStudiothat's why I'm trying to get this to change.)Besides, after I connect i go to the Object Explorer, expand the server node, and go to Replication.When i expand replication, i get the "Local Subscription" option, but nothng for Publication.( I want to work on Merge Replication, that's why I desparately need Publication to work)Am i missing something here? I did not install SqlServer separately, I only have what comes bundled with the Visual Studio  2005 Setup.

View 2 Replies View Related

Not Able To Create A DB Diagram In SQL Server 2005. No Menu Option For Creating A DB Diagram??

Apr 23, 2007

I have created a database with several tables. I want to create a database diagram to show the relationshipbetween the tables. Below are the steps from the SQL Server 2005 documentation on how to create a database diagram. The problem is that when I right click on the Database Diagrams folder I am only given two options. They are:"Working with SQL Server diagrams" and "Refresh"There is no menu choice to create a new database diagram. Can anyone tell me what the problem here is?
 
To create a new database diagramIn Object Explorer, right-click the Database Diagrams folder or any diagram in that folder.
Choose New Database Diagram on the shortcut menu.
The Add Table dialog box appears.
Select the required tables in the Tables list and click Add.
The tables are displayed graphically in the new database diagram.

View 1 Replies View Related

Simple Database - What Is Best Option?

Jan 31, 2006

Hi,

I am writing a simple program which runs on users xp machines and accesses a simple table on an NT Server.

In otherwords, the database consists of just a single table with perhaps 4 fields and a maximum of 200 records, with low transaction activity (users periodically update their status or check on other users' statuses).

Do I need to use SQL????

What is my best option for such a simple table / database.

Your help would be appreciated.

View 6 Replies View Related

ANSI NULL DEFAULT Database Option

Nov 13, 2007

Hi,I am using SQL Server 2005 32 bit version. Could any one clarify methe caption database option with some examples? I am quite confusedwith the explanation given in MSDN. Kindly help me.Thanks in Advance.Om Prakash

View 1 Replies View Related

SQL Server Database Services Option Greyed Out

Jul 15, 2007

Hi,



I'm trying to install SQL Server 2005 onto my XP Professional PC. When I get to the "Components to install" part, the "SQL server database services option" is greyed out. Infact, all options except "Workstation components..." are greyed out. I've tried uninstalling all previous versions of SQL server and trying again, but with the same results.



any help would be much appreciated

Simon

View 5 Replies View Related

Fire Triggers Option On A SQL 2000 Database

Dec 4, 2007

Hi,

I'm aware that when bulk loading to a SQL 2005 database through an OLE DB Destination, you can enable the FIRE TRIGGERS option. Is this option available when your database target is SQL 2000? I can't find it in the Properties or other windows.

View 6 Replies View Related

Update , Insert ,delete Option From The Database ? Help

Feb 11, 2006

Hello,



Where can i give on the sql server Management studio that i can insert and update, delete.

Thenks for you help

View 1 Replies View Related

Can't Change The Auto Growth Option On My Database

Aug 3, 2007



I'm currently using SQL Server 2005. Before I have set my database on unrestricted auto growth. But today, I have noticed that the Log file has been set to limit its growth to 2,097,152 MB. I have 160GB space for my log files, I just want to maximize the space for logs in my hard drive.

When I try to change the settings back to auto growth it still keeps on returning to its previous setting it is still set on 2,097,152 MB. What I did was :
Right Click on the Database - Properties - Files - Click the (...) - set the auto growth option to unrestricted - Click Ok
But when I checked log file, it is still set on 2,097,152MB.


Can some one help me change the settings of my Database.

View 6 Replies View Related

Launch Database Mirroring Monitor Is Not An Option

May 16, 2006

Good morning all...

I would like use the "Database Mirroring Monitor" to track what's going on.

All three of my servers have SQL Server 2005 x64 edition installed with SP1.

Server A is mirroring to Server C

Server B is mirroring to Server C

Following the instructions at http://msdn2.microsoft.com/en-us/library/ms365786(d=ide).aspx:

On Server A and C, "Launch Database Mirroring Monitor" appears.

On Server B, "Launch Database Mirroring Monitor" does NOT appear.

Is there something I have to do to get this tool installed on the machine, or it is an automatic thing?

Thanks!

Forch

View 8 Replies View Related

Is Databinding A Good Option In ASP .net To Manage Huge Database...?

Mar 13, 2008

I am actually a newbie to asp.net and i m using ASP.net 3.5 i.e, VWD 2008. i am using it for the first time as my tool to develop a website for my final year project. i am planning to develop an online job recruitment site like www.monster.com. Rigth now i am confused how will i manage my database. i've learned to use databinding concept of SQL SERVER in VWD 2008 but will it be enough to handle such huge # of Job postings and employers and as well as Resumes in pdf of word format? or do i have to create a separate databse in SQL Server and to connect it with my website? i am confused at the moment. please help me in this matter.
Regards,
Jigzy

View 6 Replies View Related

SQL 2012 :: Restore Database Command - BufferCount Option?

Jul 22, 2014

What the BUFFERCOUNT option does in a RESTORE DATABASE command?

View 5 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved