Altering Logical Filenames

Oct 24, 2001

Pros,

I would like to change the logical filenames for a database on my test server. I know this is done with ALTER DATABASE, but I'm not sure of the exact syntax. Can anyone help?

rb

View 3 Replies


ADVERTISEMENT

Is There A Way To Change Logical And Physical Datebase Filenames?

Aug 23, 2006

A database was set up as a test database and then the database name changed but the logical and physical filenames still have test in their name - obviously not a good idea. I have tried to change the physical file name but get the error message that the physical file name cannot be changed once the database has been created. I have also tried detaching the database and renaming the mdf and ldf files but these could not be re-attached so had to revert back to the original names.

View 2 Replies View Related

Dynamic Filenames

Nov 13, 2007

How do I build a dynamic filename using an SSIS package? Do I do this thru Expression Building?

View 10 Replies View Related

Script Objects To Different Filenames

Oct 10, 2007

I'm using SQL2005 and need to script a bunch of Tables (and possibly other objects) to files. I can't make one big file with all the objects in it. I need to create an indiviual file for each object and each filename needs to be something like dbo.objectname.sql. I will be checking each file (object script) into VSS. Can someone tell me how to do this withouth having to manually generate a script for each object? Is there a way to check each object you want scripted and the SSMS spit out a file per object?

Thanks

View 7 Replies View Related

Variables To Hold Filenames

Feb 8, 2007

I was wondering if it is possible to create a variable that holds the filename as an expression. I am using a For each loop to pick up files and i want to insert the 'Filename' as a colum in to the destination Table so that i can differentiate among the rows in my destination Table.

Using the 'Derived Colum' in DTS I can link the colum to a variable. However i do not know how to create the variable which will dynamically store the filename for each file....

Any Clues...
Would really appreciate the help.....

Or is anyone knows any other simple way of inserting the filename as a column in the destination Table ...Been stuck on this for a while...

View 6 Replies View Related

Can We Find The List Of Filenames Associated With A DB Using VDI ?

Sep 3, 2007

Hi all,
I want to find the list of filenames associated with the SQL server instance programmatically. As VDI is concerned with taking backup of SQL server. Can we find the list of filenames associated with a DB using VDI ? or Is there any other way to know filenames?

Thanks in Advance,
Ram

View 1 Replies View Related

Select All Filenames That Have ArticleID=int (was SQL Statement)

Mar 13, 2006

I have a table which has three fields.
The table name is Filename,and it has three fields:Id,ArticleID and Filename

I have an integer variable int

I want to select all the filenames that have ArticleID=int

I used the following SQL statement but it didn't work
Select Filename from Filename where ArticleID=int

wHAT'S wrong with it
Thanks

View 3 Replies View Related

Transact SQL :: Pass Filenames To A Loop

Aug 27, 2015

I’m working on building a file list from a directory I have and wish to loop through the filenames. I’ve worked out I can get the list using

EXEC
xp_dirtree @path, 10, 1

I’m just not sure out I pass this to my loop 1 element at a time.

E.g. Let’s say there are 10 files in my folder, I wish to loop through each name using my @Filename parameter

DECLARE @Path
varchar(50), @FileName
varchar(20)
SET @Path
= 'C:myFiles'
EXEC
xp_dirtree @path, 10, 1

[Code] ....

View 5 Replies View Related

Retreiving TranLog Filenames From Windows Directory

Jan 24, 2006

Due to circumstances beyond my control, I have to restore a full database backup from October 1, 2005 and then over 4400 transaction logs to bring a database up to Jan 01, 2006 on a development server (storage team lost all daily full backups from 10/02/2005 to 01/01/2006). Since the backups were not taken on this machine originally, the information I would pull from the sysjobhistory tables to get the transaction backup names is not available. Does anyone have a link or a script to pull the filenames from the backup directory into sql server so I can build a dynamic script to apply the tran logs instead of running all 4400+ of them by hand? Thanks, Tom

View 5 Replies View Related

SQL Server 2008 :: Split Apart Filenames Into A Database?

Oct 11, 2015

I am trying to break apart a list of filenames that was inserted into a database. It only breaks out the first one then moves onto the next record. If I do them individually then seem to work but not the whole table when queried. I need to break out each file into a temp table then insert them into a documents field in a database.

my filenames look like so and can have from 1 file name to 10 file names in the string.

test.pdf,test2.pdf,test4.tif,test5.pdf
somedoc.tif,test.docx,test4.pdf

This is my current method, I needed to create a cursor around it to go through all the records, split out the filenames and insert into a temp table. But if there is a better way ill do it. The problem with this is only the first file is getting inserted into the temp table and nothing else even if the filename has 4 files in it.

Create table #tempFiles (OldStrId int, OldPercent int, strfilename varchar(max), RequestId int, OblId int)
declare @OldStr int, @OldPer int, @FileName varchar(max), @intcount int;
Declare filenames CURSOR FOR Select intSTRBonusID, intPercentID, strFileName from tblSTR where strFileName > ''
UNION ALL
Select intSTRBonusID, intPercentID, strFileName from tblSTRHist where intPercentID in (61,62) and strFileName > ''

[code]....

View 2 Replies View Related

SQL Server 2012 :: Fetch Physical Filenames In Database?

Mar 26, 2015

I have a folder with 1000 text(.txt) files in it.

I want to insert the filenames into a table in sql server.

Is it possible in SQL Server 2008..?

View 4 Replies View Related

Package Configuration For Generic Pathnames And Specific Filenames

Apr 3, 2007

It's very easy to make a generic xml configuration file for the connection to the database for all packages my project contains. The connectionstring is the same for all these packages

Now I want to do the same for all flat file sources I have in my project where the connectionstring is not the same for all packages.

For example I use the following flat files in my project:

c:AAA.txt

c:BBB.txt

c:CCC.txt

If I move the packages to the production database the flat file sources are located in another directory.

So in fact for the flat file sources there is a generic part for all files (in this case 'c: ') and a specific part ('AAA.txt', 'BBB.txt' and 'CCC.txt').

Can I indicate this in the package configurations sections? And how?



Thanks,



John

View 3 Replies View Related

Integration Services :: How To Import Filenames And File Creation Date Into Table

Apr 20, 2015

I am importing Differennt Excels Files into table. my require ment is after importing completed I need to insert all these Filenames ,File creation date into table. (for Auditing).

View 9 Replies View Related

Altering Table

Dec 2, 2003

Hai All.

I want to know ,is there any way to modify a table's field like adding of new field to a table.
If any one have idea plz enlighten me.
Bye

Regards,
Karthik.A

View 1 Replies View Related

Altering Data

Jul 20, 2005

Hello!I have a problem that I really could use some help to solve. I have a tablewhich looks like this:id1, id2, id3, rate, ratenrExamples of a select * from this table would be:1047336399 21000 1 617 11047336399 21000 1 624B 11047336399 21000 1 621D 11047336399 21000 2 624B 11047336399 21000 2 612A 11047336399 21000 2 621D 11047336399 21000 3 617 11047336399 21000 3 624B 11047336399 21000 3 621D 1I would like to transform this table into something like this:1047336399 21000 1 617 1 624B 1 621D 11047336399 21000 2 624B 1 612A 1 621D 11047336399 21000 3 617 1 624B 1 621D 1the three first columns should be the primary key.Any help is appreciatedGunnar

View 1 Replies View Related

Permissions For Altering Databases

Oct 18, 2001

I have an environment where I would like to grant the ability to perform certain functions to specific users for all databases on one of my SQL Servers. Specifically, I want to allow someone to alter table structures on the server, without having the ability to modify data within any databases on the server and without having the ability to create new databases on the server. Is this possible, and if so, how?

View 2 Replies View Related

Altering A Job Scheduled In EM Of SQL2000

May 4, 2000

I was able to create a scheduled job in Enterprise Manager 8.0 on a server running 7.0, but I couldn't find a way to disable it. I've used the sp_delete_job stored procedure to delete my job and re-entered it with new parameters.
Is using the sp_delete_job sp only way to modify scheduled jobs?
If yes, I have a problem since my 7.0 Enterprise Manager is gone.
Any ideas?

Pete

View 1 Replies View Related

Altering Table With Default Value

Aug 19, 2004

Hi, How to alter a table with default value?
I am using the below statement, But, it is not working..Any pointers?
Thx..
-------------------------------
alter table action_item ALTER COLUMN STATUS default 0

View 1 Replies View Related

Altering A Computed Column?

Feb 27, 2008

somehow I am not able to figure this out.

How do I change a computed column using the ALTER TABLE ALTER COLUMN... command?

View 1 Replies View Related

Altering Column Names?

Jan 25, 2004

I have been looking in the SQL Server Help Files, but I cant seem to find the syntax to change the name of a column name..?

Can it be done? if so, what is the syntax?

View 4 Replies View Related

Altering A Published Table

Feb 12, 2004

Hi! I've added a column to a published table in the Publisher using SP_REPLADDCOLUMN. After doing this the replication triggers for that table(i.e. del_%,upd_%,ins_%) are doubled both at the Publisher and at the Subscriber. If i update anyone of the column in the table at the Subscriber; i get the following error:

Server: Msg 208, Level 16, State 1, Procedure upd_3E6DE124B82D42A5AEB169557C0D757C, Line 60
Invalid object name 'ctsv_3E6DE124B82D42A5AEB169557C0D757C'.

Any ideas, what has gone wrong????

I have the following SQL setup.
Publisher: Enterprise Edition, SP3.
Subscriber: Standard-Edition, SP3.
The error is at the Subscriber.

View 5 Replies View Related

SQL 2012 :: Altering The DB Role?

Sep 19, 2014

I have created a login with some restrictions ,By default the Login has DB_Owner Role,Now i want to change that Role to DB_datareader.

How can i alter the Login role from db_owner to db_datareader.

View 6 Replies View Related

Creating A Job To Altering Trigger

May 22, 2008

Hi Everyone,

I have a database which once every week gets backup/restored and then renamed for training purpose. The problem is that I got trigger on some of the tables and once the database gets renamed the trigger failed to work as it referring to the old database name. I have idenify all the trigger and done a ALTER TRIGGER. However I can't seem to get it to run as a JOB. Tried to create a store procedure but get a error as the ALTER TIGGER is after CREATE PROCEDURE I could do it as a SQLstring but theirs alot of trigger, want to know if there any other ways of doing it. Please help

View 2 Replies View Related

Altering The Datatype Of A Variable?

Jul 21, 2006

The DATEDIFF(s, time1, time2) function output is of the 'datetime' datatype.
How can I alter the 'datetime' to 'int' (or 'bigint') datatype to make it compatible with other variables in my calculations?

View 7 Replies View Related

Altering Linked Tables

Jul 20, 2005

I have a table (in Access) that is linked to the SQL server, and Ineed to add a column to it. I wrote the following:ALTER TABLE CensusADD COLUMN 'ActiveFacility' BIT;and I get a syntax error that I do not know how to solve. The columnneeds to contain yes/no data for each record.Any help for a struggling newbie?Thanks,Christine

View 1 Replies View Related

Help Altering/Creating Columns

May 19, 2008

I need help in SQL in 2 things:



How do i modify a column to change it to a primary key

How do i add a column that is of type bit, with no nulls, and a default value of ((0))
Thanks

Kevin

View 5 Replies View Related

MS SQL 2005 Log Shipping And Altering A DB

Feb 26, 2008

Question: I have Log Shipping setup and i am wanting to verify it will do what we need. That is when a table is changed in our production enviroment that change is replicated into our other server. IE I rename a field in a table or create a new table... You know change the structure... How do I replicate that stuff to my other servers?

View 6 Replies View Related

Merge Altering Metadata

Aug 8, 2007

I have a column going into a merge DT_WSTR length 50 on both(left/right) sides, yet when viewing the resulting output metadata, the length is 16. (I am viewing the metadata by clicking on the arrows)

This is obviously wrong.

NB originally the length was not set to this. As an attempt to try and fix the problem, I have added a placeholder column before all of my conditional splits of str50 type.

Why is it doing this?

This is causing my 0xC02020C1 error, I am convinced of it.

One of the errors has now gone away but the other two merges still have the error.


SSIS seems to assume that you will make no mistakes and will never want to go back and change anything, woe betide you if you have to go back and alter it later.

I have also noticed that certain (other) errors go away merely by opening and closing the tasks. Shocking.

View 1 Replies View Related

Altering Table Replicated

Feb 2, 2007

How can i change my Table Structure that is replicated?

I need to add a new field.

View 1 Replies View Related

ALTERing A Column CHECK Constraint

Aug 18, 1999

How do I alter a column check constraint?

I have the table:

CREATE TABLE Mytable(
mykey integer,
mycol integer
CHECK(mycol BETWEEN 1 AND 2)
PRIMARY KEY(mykey))

How do I change the constraint to
CHECK(mycol BETWEEN 0 AND 2)

...without losing any data?

Thanks!
Jim

View 1 Replies View Related

Dynamically Altering/creating Tables

Jul 22, 1998

Folks,
Is there any way I can dynamically alter the structure of a table? In other words if my Transact SQL
statement returns 5 rows I want to alter an existing table and put in 5 columns. Strange?!
Something like
alter table add
column+@i
The alter table statement is within a Cursor and ideally @i should increment each time and alter
the table to put in a new column.
If I went 3 times thru the loop, I should have
column1
column2
column3

added to the new table.

Any pointers would be greatly appreciated. Thanks much in advance.

View 1 Replies View Related

Altering Table && Trans. Replication

Jul 23, 2005

Hi,How can I modify table with publication (change of one column length)without completely breaking replication.Thanks in advance

View 1 Replies View Related

Altering Functions And CHECK Constraints

Jul 23, 2005

Let's say I create a multi-statement function like this:CREATE FUNCTION dbo.Test ()RETURNS @res TABLE (N int NOT NULL CHECK (N >= 0))ASBEGININSERT INTO @resSELECT 1RETURNENDThat works fine. Then I make a change in the function's body, replace theCREATE FUNCTION with ALTER FUNCTION, and execute the batch. I get an error:Server: Msg 3729, Level 16, State 3, Procedure Test, Line 9Cannot ALTER 'dbo.Test' because it is being referenced by object'CK__Test__N__5D2E32EB'.Indeed, if I look at the list of dependencies for the function in QA'sobject tree, I can see the check constraint referenced in the errormessage.ALTER FUNCTION works fine if I don't specify the CHECK constraint in thedefinition of the @res table.So it seems that the only way to modify such a function is to drop andrecreate. Is that a known behavior? Is there any particular reason for it?Thanks.--(remove a 9 to reply by email)

View 1 Replies View Related







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