SQL Server 2012 :: Dynamically Grow A Data File?

Dec 5, 2014

Is it possible to dynamically grow a data file for TempDB?

I have some TSQL that I want to execute (this is raw tsql, not something I'd typically share) when I get an alert that TempDB is growing.

SET NOCOUNT ON;
DECLARE @TempDB TABLE (FileID tinyint, name varchar(50), size bigint)
DECLARE @TotalSize decimal(19,4), @TotalFiles int, @CurrentTempDBSize bigint, @SQL varchar(1000), @DBName varchar(50)
SET @SQL = ''
INSERT INTO @TempDB

[code]....

ENDThe code runs fine, but doesn't actually increase the size of the file.

View 7 Replies


ADVERTISEMENT

SQL Server 2012 :: Handling Flat File Destinations Dynamically?

Feb 5, 2015

After performing a join operation on two tables i get the below resultset

pid, fname, typename, pname, pcost

1, cad, bars, product-1, 100

2, har, witte, product-2, 120

3, nes, bars, product-3, 119

Now i need to create files with the obtained resultset like

Column 'fname' is the folder name and 'typename' should be the file in the particular folder.

For example the first record should be inserted into file name 'bars.txt' in the folder 'cad' and third record should be created in file name 'bars.txt' in the folder 'nes'.

View 2 Replies View Related

Proactively Grow Data File Size

Jan 9, 2008

My primary (and only) data file has reached the point where it is auto growing. I would like to grow this file in one big chunk at an off peak time. I can't seem to find the code I need to make the file grow when I want it to?

View 1 Replies View Related

SQL Server 2012 :: Dynamically Hourly Data Extraction?

Dec 1, 2014

I am using SSIS package for pulling the data(last 2 months data).

Since the data size is huge, i have to split the data into hourly basis and pull the data.

how i can make this dynamic? Right now i am changing the hours manually after package execution.

View 9 Replies View Related

SQL Server 2012 :: Dynamically Map Metadata In A Data Flow Task

Oct 1, 2014

I am tasked with truncating and reloading tables from one server to another. Company policy prevents cross-server queries, but allows SSIS packages with cross-server connections. I am doing this for about 25 tables. I have the table names in a single table & I have created an FEL to execute tasks against each table one-by-one. It works fine to truncate all the tables. I run into issues, though, with the DataFlowTask. I'm able to tell it which server & table to dynamically connect from and to, but it doesn't know how to map the metadata. They're the exact same columns and field names in both source & destination.

View 9 Replies View Related

How Data File And Log File Grow?

Jul 20, 2005

Greetings,The following shows how the Properties of a database look like:Data Files:File Name: student_datLocation: e:dataMSSQLDatastudent.mdfSpace allocated (MB): 62'Automatically grow file' checkedFile growth: 'By percent 10%' checkedMaximum file size: 'Unrestricted file growth' checkedTransaction Log:File Name: student_logLocation: e:dataMSSQLDatastudent.ldfSpace allocated (MB): 52'Automatically grow file' checkedFile growth: 'By percent 10%' checkedMaximum file size: 'Unrestricted file growth' checkedThe physical files look like this:Name Size Type Modified------------------------------------------------student.ldf 52,416 KB Database File 2/11/2004 10:34PMstudent.mdf 63,424 KB Database File 2/11/2004 10:34PMMy question is now that it has been specified 'Unrestricted file growth'for both the data and the log file, why both haven't increased any insize since 2/11/2004? Actually, the modified timestamps of some otherdatabases files are also '2/11/2004 10:34PM'. That's weird.I found the following message that's relevent to the above timestamp inthe SQL Server Logs:=====2004-02-11 22:34:10.12 server SQL Server terminating because ofsystem shutdown.=====I'm pretty sure there have been a lot updates taking place on thisdatabase. We don't hear any complaints from the customers that theyhave had any problems (such as, no space left) with the databases.Did the SQL server write the data and log somewhere else?Any insight on what's going on would be appreciated.Bing

View 7 Replies View Related

SQL Server 2012 :: Dynamically Create A Script Only Selecting Columns Where There Is Data?

Dec 2, 2013

I have created some dynamic sql to check a temporary table that is created on the fly for any columns that do contain data. If they do the column name is added to a dynamic sql, if not they are excluded. This looks like:

If (select sum(Case when [Sat] is null then 0 else 1 end) from #TABLE) >= 1 begin set @OIL_BULK = @OIL_BULK + '[Sat]' +',' END However, I am currently running this on over 230 columns and large tables 1.3 mil rows and it is quite slow. How I can dynamically create a sql script that only selects the columns in the table where there is data in a speedier manner. Unfortunately it has to be on the fly because the temporary table is created on the fly.

View 1 Replies View Related

SQL 2012 :: Dynamically Handling Multiple File System With Different / Similar Headers

Apr 18, 2015

Would it be possible to handle multiple file systems (e.g. xlsx, csv, mdb) with different /similar headers in single package without Script Component?

View 1 Replies View Related

SQL Server Admin 2014 :: How Do Physical Data Files Grow When Rebuilding Indexes

Feb 2, 2015

I've been trying to get a definitive answer to this question but alas I have conflicting and patchy answers so far from other sources. I have an index that, lets say, requires 10GB of data space to rebuild..This index resides on a filegroup that spans 2 files on two seperate drives (i.e. a mdf and ndf)

When I rebuild this index how will each of these datafiles grow as the rebuild proceeds to completion? Lets for the time being remove the caveats of any other activity hitting the example index/database in question.My tests seem to show that only the mdf will grows (or the file with the lowest id in the that filegroup) provided there is enough space available in that particular file to complete the operation. The secondary ndf dat file doesnt grow at all if the mdf has enough space.

Is expected behavior? i.e. the index will be rebuilt in a contiguous manner relative to the files contained with the filegroup i.e. fileid 1 will grow till limit reached then next fileid grows etc?

View 0 Replies View Related

LDF File Does Not Grow..

Jun 27, 2007

Bear with me - My SQL Server 2005 Maintenance is as good as a Newbie..

I was running a Very Large Transaction over the weekend (Say 10Mill Inserts)..
And after waiting for 3/4 Hrs for the transaction to complete -- Checked the LDF File, I has grown to a 100 GB.

After that i discovered that i had the Recovery Model as FULL .. So Killed the Job and Changed the recovery mode from Full -> Simple.

Now i see that the LDF file is not growing in size even though there are many transactions that were complete successfully (Still Very slow though)...

What am i missing here - Iam clueless as to why my LDF is not growing in size?

Any Ideas??

View 4 Replies View Related

Automatically Grow File

Jan 8, 2004

Hello everyone,
I have 45 GB db with
-Automatically grow file by 10 %
- full recovery
-log shipping every 5 minutes.
-full backup every 24 hrs

database grown from 33GB to 45 GB for 1 year period
4-5 times a year massive insert
done to database(no specific dates)

if I change autogrow to by 300MB or 4%

1.how would it affect insert process ?
2.how it affect daily performance ?

Thank you
Alex

View 3 Replies View Related

Automaticallly Grow File

Oct 1, 2004

What is the best option to set for File Growth?

Is it in megabytes or by percent?

View 3 Replies View Related

Sql 2005 Log File Grow Too Much

Oct 9, 2007



Hello,

I'm running a long and heavy query. during the running the log file of the DB is growing more than 20 GB and i'm running out of disk space consequently. Is there a way to restrict the log file size without demaging my query?

Thanks.

View 9 Replies View Related

Dynamically Exporting Data To Access File

Jun 19, 2007

I am looking a way to export SQL Server 2005 DB tables to Access file dynamically. Like if i have added or removed any tables from SQL DB then when i run SSIS package it should export that table with data to Access file. is there any easy way to do this. if it is not them please someone please tell me which controls should i look at and which technique i should use to do this.

View 4 Replies View Related

My Log File Has Grow The Disk Full

Mar 20, 2004

My logfile has grow the disk full - the logfil is 25 gb and I have 4 gb free.

I can't shrink the log fil !

Can I set the log file to null ??

I have backup my datafil successfully!

Help!

View 9 Replies View Related

Auto Grow Enabled But DB Won't Grow

Jan 15, 2005

I've been through the forum and read a number of threads on people's DBs not growing and the answer usually is they don't have auotmatically grow data file. Unfortunately I have this on, but when I look at the properties of the database it reports the space available is 0.00 MB? Up until about two weeks ago I was showing appx 48% space utilization. When I ran an SP to show growth, it tells me that it was expanded by 20% yesterday, but SQL Server is still telling me the space available is zero.

The log file is also set for auto growth. The DB is 14.5 GB in size and the drives still have around 92 GB of space.

Has anyone experienced this before? Any ideas? Does anyone know of an SPs that can give me detailed info on internal data file size compared to stated size (i.e. wasted space in data file)? Is SQL Server doing something funny in the way it is seeing the database or data files individually? Any help is appreciated.

View 6 Replies View Related

DB Engine :: Analyzing What Is Causing The Log File To Grow

Aug 20, 2015

For one of our database we have an issue where its log file got increased rapidly last week on Fri and Sat. The database is on SQL  server 2008 R2 with compatibility level at 80. Please see below log grow events :

First, we thought Index maintenance like Re-index and update stats could have been the reason, but when check the schedule that job ran on 16th using below code:

USE ABC
GO
EXEC sp_MSforeachtable @command1="print '?' DBCC DBREINDEX ('?', ' ', 80)"
GOEXEC sp_updatestatsGO

I know above is OLD fashioned, but we believe that should not be the major cause here? How can i determine what happened on 14th and 15th which cause the event to trigger and log file bumps to 80 and 70 GB both days.

View 8 Replies View Related

DB Engine :: Why Does Log File Grow When Recovery Mode Is Simple

Jul 30, 2015

My understanding is that the log file is not supposed to grow if the database is under simple recovery mode.I am in a situation where the log grows if do any inserts that involve millions of rows.How do i make sure that it does not grow?

View 11 Replies View Related

SQL Server 2012 :: Dynamically Copy The Table From One DB To Another?

Nov 27, 2014

Need to scheduled to copy table data from one database to another database daily @7:00 AM by creating the table with date and time stamp.

Example :

Test1DB ---> Table1

Test2DB -----> Table1_281120140700 in Day1 and Table2_291120140700 in Day2.....and so.

SELECT * INTO Test2db.dbo.new_table_name FROM Test1db.dbo.old_table_name in this format ??

script and scheduled to run daily @ 7:00AM?

View 1 Replies View Related

SQL Server 2012 :: Open EDI File And Insert Data Into Tables

Sep 27, 2012

Is there a way to open EDI file in SQL Server and insert the data into tables?

View 9 Replies View Related

Using SSIS Package To Dynamically Load Data From Database Into Three Separate Flat File

Jul 24, 2015

I have three tables in data base:

customer
product
sales

And i want to use SSIS package dynamically load data from database into three separate flat file, each table into each file.

I know i got to use for each loop task ADO.Net schema row set enumerator, with OLEDB connection manager, select table name or view name variable from access mode list, but the problem comes, as table name is dynamic then flat file connection is also dynamic, i am using visual studio 2013...

View 5 Replies View Related

SQL Server 2012 :: Insert Into Table Statement Dynamically

Apr 20, 2015

I am having 2 tables one is staging temp and another is main import table.

In my staging table there are 3 column Col001,Id,Loaddate

in Col001 column data are present with '¯' delemeter.

I am having function which is used to load data from staging to import table using one function.

this function create a insert statement.

My Existing function

-- Description: To Split a Delimited field by a Delimiter
ALTER FUNCTION [dbo].[ufn_SplitFieldByDelimiter]
(
@fieldname varchar(max)
,@delimiter varchar(max)
,@delimiter_count int

[Code] ....

I am unable to get correct statement with above function.

View 1 Replies View Related

SQL Server 2012 :: Loading And Reformatting Text File Data Into Table

May 29, 2015

I am looking for a way to convert the following format into a sql table. The format it is Bib Tex.

Essentially a new row in the table would be for each entry, denoted by an @ logo and each column is denoted by an =, as you can see from the example data no one contains all the possible columns and some fields can be over two lines long.

To load this I was considering loading it into a table as each line being a row. Adding a row number, then a column counting the @ signs in order and essentially grouping each record, then for each group running through and looking for the column keywords 'author' , 'title' etc then splitting the data out into those constituent parts using substring and charindex.

@Book{hicks2001,
author = "von Hicks, III, Michael",
title = "Design of a Carbon Fiber Composite Grid Structure for the GLAST
Spacecraft Using a Novel Manufacturing Technique",
publisher = "Stanford Press",
year = 2001,

[Code] ....

View 9 Replies View Related

SQL Server 2012 :: Create Table Syntax Dynamically On Run Time

Apr 19, 2015

I am having 100 of flat files need to load in respective staging table.I want to create table on run time as per filename input.suppose if input filename is ABC then table name should be Staging_ABC if file name is XYZ then it should be Staging_XYZ.Table structure is below need to create at run time

CREATE TABLE Staging_'Filename'(
[COL001] [varchar](4000) NULL,
[Id] [int] IDENTITY(1,1) NOT NULL,
[LoadDate] [datetime] NOT NULL default getdate()
)

View 2 Replies View Related

SQL Server 2012 :: Syntax Error While Creating Table Dynamically

Apr 19, 2015

I am getting error when I am trying to create table on runtime

Declare @FileName varchar(100)
Declare @File varchar(100)
set @FileName='brkrte_121227102828'
SET @File = SUBSTRING(@FileName,1,CHARINDEX('_',@FileName)-1)
--=select @File

[Code] ....

Error massage:-
Msg 203, Level 16, State 2, Line 16

The name 'CREATE TABLE DataStaging.dbo.Staging_brkrte ( [COL001] VARCHAR (4000) NOT NULL, [Id] Int Identity(1,1), [LoadDate] datetime default getdate() )' is not a valid identifier.

How to resolve above error....

View 4 Replies View Related

SQL Server 2012 :: Removal Of Records Dynamically Using Information Schema

Aug 14, 2015

I'm looking to dynamically remove records from tables dynamically using the information schema within SQL Server. Looking to remove records from all the tables within a schema. I have gotten as far as generating the script dynamically then using a while exist clause to execute the delete statements.

DECLARE@TargetSchema varchar(100),
--@LibNameData varchar(100),
@fnameIndex varchar(100),
--@startOFR_SCR_FILENAME_DATE varchar(25),

[code]...

Would like to execute the statements generated by the results from the information schema.

View 6 Replies View Related

How Data/log Files Grow

Dec 4, 2007

Hi All
i am bit confused about how data and log files grow in databases. suppose i turn off the auto grow and restrict the maxsize upto some limit but size of data/log file is less then maxsize at some stage because what i understand is size of data/log file keep changing depends upon the activities going on the database. in future if data/log file need to grow can it grow upto the maxsize without turing on the auto grow.

regards

View 4 Replies View Related

Store Procedure To Load Data From Flat File To Staging Table Dynamically - Column Metadata

Apr 9, 2015

I am having one store procedure which use to load data from flat file to staging table dynamically.

Everything is working fine.staging_temp table have single column. All the data stored in that single column. below is the sample row.

AB¯ALBERTA ¯93¯AI
AI¯ALBERTA INDIRECT ¯94¯AI
AL¯ALABAMA ¯30¯

After the staging_temp data gets inserted into main table.my probelm is to handle such a file where number of columns are more than the actual table.

If you see the sample rows there are 4 column separated by "¯".but actual I am having only 3 columns in my main table.so how can I get only first 3 column from the satging_temp table.

Output should be like below.

AB¯ALBERTA ¯93
AI¯ALBERTA INDIRECT ¯94
AL¯ALABAMA ¯30

How to achieve above scenario...

View 1 Replies View Related

Integration Services :: Create SSIS Package Dynamically For Inserting Data From Flat File To Table?

Sep 30, 2015

I have requirement like  to develop dynamic package for inserting data from flat file to table.

Find below points for more clarification :--

1) if I changed the flat file values and name  in source variable AND  the table name should be also changed based on variable value .

2) it should dynamically mapped with column values with source file as we have to insert data in target table.

See below diagram for more clarification.

View 10 Replies View Related

SQL 2012 :: How To Capture Data Flow Component Name Dynamically While Package SSIS Package Is Executing

Jun 3, 2014

I would like to fetch the data flow component name while package is executing. Since system variable named [System::SourceName] only fetches name of the control flow tasks? Is there a way to capture them?

View 5 Replies View Related

SQL Server 2012 :: Unable To Load Data From Flat File To Table Using Bulk Insert Statement

Apr 3, 2015

I am unable to load data from flat file to sql table using bulk insert sql statement

My code:-

DECLARE @filePath VARCHAR(200)
DECLARE @sql VARCHAR(8000)
Declare @filename varchar(100)
set @filename='CCNVZ_150401054418'
SET @filePath = 'I:IncomingFiles'+@FileName+'.txt'

[Code] .....

View 1 Replies View Related

How To Dynamically Change Source Text File In Sql Server Dts

Sep 25, 2006

Hi ,

I have a table (source file) where all sourse file(its all text file) name and location stored. i have a dts packeage, through this package all the sourse file will upload. So I need to dynamically change the source file name in dts packages.

How i can do it??????

Can any body plz help me out!

Thnaks

SAndipan

View 1 Replies View Related

HELP-Create Sample Data By Microsofst Spoil And Grow My Mdf Ldf -from 5 MB TO 6 GB

May 21, 2008

help i run this
from this link
http://code.msdn.microsoft.com/SQLExamples/Wiki/View.aspx?title=NumbersTable&referringTitle=Home
and it stuck my sql server!!!!!

and after i run this
my my mdf ldf is 6 GB




Code Snippet-- Suppress data loading messages
SET NOCOUNT ON

-- Create Sample Data using a Table Varable
SELECT TOP 2147483647 IDENTITY(INT,0,1) AS N
INTO Numbers
FROM sysobjects a, sysobjects b, sysobjects c, sysobjects d, sysobjects e


before i was 6 mb
help
now how to fix this problem and shrinking my data



View 8 Replies View Related







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