Create Table From Text

Jul 23, 2005

Hi, all. I'm fairly new to SQL, and I have been trying to create a table
from a text file. I have been looking at this for days, and can't find the
problem. I get a syntax error " Line 55: Incorrect syntax near
'DateUpdated'." Here is the query. Any suggestions would be appreciated,
as I am trying to learn and improve.

Use ACH
go

if exists (select * from dbo.sysobjects where id =
object_id(N'[dbo].[ImportFiles]') and OBJECTPROPERTY(id, N'IsProcedure') =
1)
drop procedure [dbo].[ImportFiles]
GO

CREATE Procedure ImportFiles
@FilePath varchar(1000),
@MergeProc varchar(128) = 'MergeData'
AS
DECLARE @cmd varchar(2000),
@Command_String varchar(3000)

DECLARE @FileName varchar(1000),
@File varchar(1000)

CREATE table ##Import (datarow varchar(200))
CREATE table #Dir (datarow varchar(200))

DROP TABLE ACHParticipants

select @cmd = 'dir /B' + @FilePath
delete #Dir
insert #Dir exec master..xp_cmdshell @cmd

delete #Dir where datarow is null or datarow like '%not found%'

while exists (select * from #Dir)

BEGIN
select @FileName = min(datarow) from #Dir
select @file= @FilePath + @FileName
select @cmd = 'bulk insert'
select @cmd = @cmd + ' ##Import'
select @cmd = @cmd + ' from'
select @cmd = @cmd + ' @File,'
select @cmd = @cmd + ' with (FIELDTERMINATOR=''
'''
select @cmd = @cmd + ',ROWTERMINATOR = '':
'')'

truncate table ##Import

-- import the data
exec (@cmd)

-- remove filename just imported
delete #Dir where datarow = @FileName

exec @MergeProc
END

drop table ##Import
drop table #Dir
GO

if exists (select * from dbo.sysobjects where id =
object_id(N'[dbo].[MergeData]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[MergeData]
GO

CREATE PROCEDURE MergeData
AS
CREATE table ACHParticipants
(RoutingNum varchar(9),
OfficeCode varchar(1),
ServicingFRBNum varchar(9),
RecordType varchar(1),
ChangeDate varchar(8),
NewRoutingNum varchar(9),
BankName varchar(36),
BankAddress varchar(36),
City varchar(20),
State varchar(2),
Zipcode varchar(10),
Phone varchar(14),
StatusCode varchar(1),
DataView varchar(1),
Filler varchar(5),
DateUpdated datetime)

INSERT INTO ACHParticipants
(Routing_Number
, Office_Code
, Servicing_FRB_Number
, Record_Type_Code
, Change_Date
, New_Routing_Number
, Customer_Name
, Address
, City
, State_Code
, Zipcode
, Telephone
, Institution_Status_Code
, Data_View_Code
, Filler
, DateUpdated)

SELECT Substring(DataRow,1,9) AS RoutingNum,
Substring(DataRow,10,1) AS OfficeCode,
Substring(DataRow,11,9) AS ServicingFRBNum,
Substring(DataRow,20,1) AS RecordType,
convert(datetime,Substring(DataRow,21,6)) AS ChangeDate,
Substring(DataRow,27,9) AS NewRoutingNum,
Substring(DataRow,36,36) AS BankName,
Substring(DataRow,72,36) AS BankAddress,
Substring(DataRow,108,20) AS City,
Substring(DataRow,128,2) AS State,
Substring(DataRow,130,5) + '-' + Substring(DataRow,135,4) AS Zipcode,
Substring(DataRow,139,3) + '-' + Substring(DataRow,142,3) + '-' +
Substring(DataRow,145,4) AS Phone,
Substring(DataRow,149,1) AS StatusCode,
Substring(DataRow,150,1) AS DataView,
Substring(DataRow,151,5) AS Filler
DateUpdated datetime AS DateUpdated
FROM ##Import
GO


Thanks,
Karen

View 2 Replies


ADVERTISEMENT

Create Table From Text File, Extract Data, Create New Table From Extracted Data....

May 3, 2004

Hello all,

Please help....

I have a text file which needs to be created into a table (let's call it DataFile table). For now I'm just doing the manual DTS to import the txt into SQL server to create the table, which works. But here's my problem....

I need to extract data from DataFile table, here's my query:

select * from dbo.DataFile
where DF_SC_Case_Nbr not like '0000%';

Then I need to create a new table for the extracted data, let's call it ExtractedDataFile. But I don't know how to create a new table and insert the data I selected above into the new one.

Also, can the extraction and the creation of new table be done in just one stored procedure? or is there any other way of doing all this (including the importation of the text file)?

Any help would be highly appreciated.

Thanks in advance.

View 3 Replies View Related

How To Create Table On Text File Import?

Sep 27, 2007

Hey guys,
I have a dilemma and hope someone can help.

I don't know of any utilities or commands in SQL that do this but I hope someone does.

What I need to do is something like a bcp import a text file in. I can do that with DTS as well. But what I wanted to do is create a table on the import. So lets say, I am importing a tab-delimited file with column names as the first row that is called ax.txt. On import, it would create the table ax with the column names in the file and then import the data into that table.

I hope I explained it clearly. Please let me know if there is anything I can use to do this without writing lots of code.

I have an idea how to do it the long way but hope there is a utility that already does it.

Thanks in advance.

View 10 Replies View Related

Can't Create A Full-text Index Or Catalogue On My Sql Table.

Sep 28, 2006

I am trying to run an SELECT statement with a CONTAINS statement from a aspx.net solution built using Visual Web Developer 2005 express edition. When I try to run the thing it throws an error saying

"Cannot use a CONTAINS or FREETEXT predicate on table or indexed view 'JournalArticle' because it is not full-text indexed.".

I don't have access to the SQL Express server, I interface through Server Management Studio Express. There is an option to create a full-text index from the menu, but it is greyed out, presumably because there is no full-text catalogue. This is my real question, How do I create a full-text catalogue using Server Management Studio Express? The help function only provides examples of sql code, which I assume must be performed using sql server (which I don't have access to). Any help would be greatly appreciated.

cheers,

Bernie

View 6 Replies View Related

Error Msg 6522, Level 16, State 1 Receives When Call The Assembly From Store Procedure To Create A Text File And To Write Text

Jun 21, 2006

Hi,
I want to create a text file and write to text it by calling its assembly from Stored Procedure. Full Detail is given below

I write a code in class to create a text file and write text in it.
1) I creat a class in Visual Basic.Net 2005, whose code is given below:
Imports System
Imports System.IO
Imports Microsoft.VisualBasic
Imports System.Diagnostics
Public Class WLog
Public Shared Sub LogToTextFile(ByVal LogName As String, ByVal newMessage As String)
Dim w As StreamWriter = File.AppendText(LogName)
LogIt(newMessage, w)
w.Close()
End Sub
Public Shared Sub LogIt(ByVal logMessage As String, ByVal wr As StreamWriter)
wr.Write(ControlChars.CrLf & "Log Entry:")
wr.WriteLine("(0) {1}", DateTime.Now.ToLongTimeString(), DateTime.Now.ToLongDateString())
wr.WriteLine(" :")
wr.WriteLine(" :{0}", logMessage)
wr.WriteLine("---------------------------")
wr.Flush()
End Sub
Public Shared Sub LotToEventLog(ByVal errorMessage As String)
Dim log As System.Diagnostics.EventLog = New System.Diagnostics.EventLog
log.Source = "My Application"
log.WriteEntry(errorMessage)
End Sub
End Class

2) Make & register its assembly, in SQL Server 2005.
3)Create Stored Procedure as given below:

CREATE PROCEDURE dbo.SP_LogTextFile
(
@LogName nvarchar(255), @NewMessage nvarchar(255)
)
AS EXTERNAL NAME
[asmLog].[WriteLog.WLog].[LogToTextFile]

4) When i execute this stored procedure as
Execute SP_LogTextFile 'C:Test.txt','Message1'

5) Then i got the following error
Msg 6522, Level 16, State 1, Procedure SP_LogTextFile, Line 0
A .NET Framework error occurred during execution of user defined routine or aggregate 'SP_LogTextFile':
System.UnauthorizedAccessException: Access to the path 'C:Test.txt' is denied.
System.UnauthorizedAccessException:
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, ileOptions options)
at System.IO.StreamWriter.CreateFile(String path, Boolean append)
at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize)
at System.IO.StreamWriter..ctor(String path, Boolean append)
at System.IO.File.AppendText(String path)
at WriteLog.WLog.LogToTextFile(String LogName, String newMessage)

View 13 Replies View Related

Problems On Create Proc Includes Granting Create Table Or View Perissinin SP

Aug 4, 2004

Hi All,

I'm trying to create a proc for granting permission for developer, but I tried many times, still couldn't get successful, someone can help me? The original statement is:

Create PROC dbo.GrantPermission
@user1 varchar(50)

as

Grant create table to @user1
go

Grant create view to @user1
go

Grant create Procedure to @user1
Go



Thanks Guys.

View 14 Replies View Related

Boolean: {[If [table With This Name] Already Exists In [this Sql Database] Then [ Don't Create Another One] Else [create It And Populate It With These Values]}

May 20, 2008

the subject pretty much says it all, I want to be able to do the following in in VB.net code):
 
{[If [table with this name] already exists [in this sql database] then [ don't create another one] else [create it and populate it with these values]}
 
How would I do this?

View 3 Replies View Related

Dynamic Create Table, Create Index Based Upon A Given Database

Jul 20, 2005

Can I dynamically (from a stored procedure) generatea create table script of all tables in a given database (with defaults etc)a create view script of all viewsa create function script of all functionsa create index script of all indexes.(The result will be 4 scripts)Arno de Jong,The Netherlands.

View 1 Replies View Related

Can CREATE DATABASE Or CREATE TABLE Be Wrapped In Transactions?

Jul 20, 2005

I have some code that dynamically creates a database (name is @FullName) andthen creates a table within that database. Is it possible to wrap thesethings into a transaction such that if any one of the following fails, thedatabase "creation" is rolledback. Otherwise, I would try deleting on errordetection, but it could get messy.IF @Error = 0BEGINSET @ExecString = 'CREATE DATABASE ' + @FullNameEXEC sp_executesql @ExecStringSET @Error = @@ErrorENDIF @Error = 0BEGINSET @ExecString = 'CREATE TABLE ' + @FullName + '.[dbo].[Image] ( [ID][int] IDENTITY (1, 1) NOT NULL, [Blob] [image] NULL , [DateAdded] [datetime]NULL ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]'EXEC sp_executesql @ExecStringSET @Error = @@ErrorENDIF @Error = 0BEGINSET @ExecString = 'ALTER TABLE ' + @FullName + '.[dbo].[Image] WITHNOCHECK ADD CONSTRAINT [PK_Image] PRIMARY KEY CLUSTERED ( [ID] ) ON[PRIMARY]'EXEC sp_executesql @ExecStringSET @Error = @@ErrorEND

View 2 Replies View Related

Create Text File

Feb 13, 2002

Is there a way in a stored procedure to create a text file with the results from a query?

If not, is there a way to execute a DTS package from a stored procedure?

Thanks,
Ken Nicholson

View 2 Replies View Related

Create Text File

Dec 27, 2006

I'm looking for a simple way to create a text file inside a stored procedure. I want to set it up so the end user would just execute the SPROC that would run the required queries and dump the result into a custom formated text file.

I tried BCP but could not lauch it inside the SPROC without using OSQL. I am running SQL Server 2003 64bit. Any ideas?

View 3 Replies View Related

Create A Text File Using SP

Apr 17, 2006

Hi!
I'm trying to create a txt file using the information of my PO lines tables, is there any way to do this using a SP.

View 1 Replies View Related

ISP - Create Text Dump

Mar 22, 2007

I'm using an ISP with SQL Server, the Database Publishing Wizard worked great to create a text.sql file which recreated the exact replica of the local db on the ISP's SQL Server.
But, is there a code library for this somewhere so I can run this automatically on the the server and post the text.sql file off as a local backup?

View 2 Replies View Related

How To Create Vertical Text?

Jan 13, 2006

Hi,

Does anyone know how to format a text in a textbox or a table cell to show vertically?

Or, rotating a textbox with 90 degree angle? Thanks.

 

View 3 Replies View Related

How To Create A Full Text Search In DB.

Dec 29, 2005

Hi everibody.
My name is Ivan and I am from Slovakia.
I would like to ask you all for helping me in creating a full text search in database.
I am working in Visual Web Developer 2005.
I have a simple table in wich i have this atributes: ID, NAME, DESCRIPTION, CONTENT
I would like to use the search for this:
When I write down for example a NAME to a textarea (whatever else it can be), I need to get back the information about the ID of the apropriate NAME.
I would really appreciate your help here.
Please can you send me a mail with the solution or any help on ivoporsche@szm.sk
Thank you very much in advance.
 
 

View 1 Replies View Related

Create Text File And Ftp With Trigger

May 24, 2007

Good day,

I hope someone can help me.

Question 1:
Is it possible to create a text file from a sql server trigger?

Question 2:
Is it possible to ftp a file from a sql server trigger?

Please if anyone can help I would appeciate it.

Thanks

View 10 Replies View Related

Create Trigger To Format Text

Mar 4, 2015

We are using an old version of Numara TrackIT for our helpdesk software, and it doesn't have much in the way of configurable options. There is no way to set validation or formatting on the text fields in the program.

There is a field, WO_TEXT1, Which I would like to be formatted as 6 characters, 3 integers + a period + 2 integers. The first the integers would be padded with zeros on the left, and the last 2 integers would be padded with zeros on the right.

IE, if someone enters 2, it would actually end up being 002.00
If someone enters 3.5 it would end up being 003.50
If someone enters 12.1 it would end up being 012.10
If someone enters 172.80 it would end up being 172.80

I was hoping to achieve this via an update trigger.

Below is the guts of the trigger I created, mostly as a proof of concept.

-- This update properly formats the Estimated Hours field
Update t SET WO_TEXT1 = (SELECT RIGHT('000000' + CONVERT(VARCHAR(6), WO_TEXT1), 6) FROM inserted)
FROM dbo.TASKS as t
Where (EXISTS (SELECT * FROM inserted WHERE WOID = 24773));

I expected that this update trigger would only affect the Work Order with a WOID of 24773. Unfortunately, it updated all 21000 work orders in our system, wiping out all of the actual estimated hours that had been inserted by technicians!

Luckily I had a report that I could quick dump the 300 or so active work order's estimated hours back into the DB from (all the other Work orders are closed, and no one really cares about their estimated hours).

My question is three fold,

1) Why did my trigger update every record in the tasks table instead of just WO 24773?
2) Is using a trigger the best way of accomplishing what I'm trying to do?
3) if a trigger is the best way of accomplishing this, what should my trigger look like?

View 12 Replies View Related

Trying To Dynamically Create Text Files

Oct 27, 2006

I need to get a list of customer ids and then use them as a parameter to select from a transaction table and then create a file for each customer. I have used an execute SQL task to get the list of customers and have put the result set into a variable.

How do go through the recordset to create a file for each customer?

View 1 Replies View Related

Create Mobile Database From Xls, Csv, Text Or Mdb

Nov 28, 2006

Hello,

Since my experience in VS is extremely limited, i'd like to be exused if questions sound silly.

My problem is that, at my device application project, i want to build a database that will retrieve data from .xls, or .csv, or .txt, or .mbd files. If i've noticed well, there is no support for OLEDB or ODBC, since by the time that i add tableadapter to my database.xsd and use these, after insertion i get multiple errors informing that system.data.oledb. .... or .odbc "type is not defined".

If it cannot be done, and since i still try to figure out how smart devices function, transact with databases, e.c.t. is there any suggestion?



Thank you in advance

Kostas

View 8 Replies View Related

Default Table Owner Using CREATE TABLE, INSERT, SELECT && DROP TABLE

Nov 21, 2006

For reasons that are not relevant (though I explain them below *), Iwant, for all my users whatever privelige level, an SP which createsand inserts into a temporary table and then another SP which reads anddrops the same temporary table.My users are not able to create dbo tables (eg dbo.tblTest), but arepermitted to create tables under their own user (eg MyUser.tblTest). Ihave found that I can achieve my aim by using code like this . . .SET @SQL = 'CREATE TABLE ' + @MyUserName + '.' + 'tblTest(tstIDDATETIME)'EXEC (@SQL)SET @SQL = 'INSERT INTO ' + @MyUserName + '.' + 'tblTest(tstID) VALUES(GETDATE())'EXEC (@SQL)This becomes exceptionally cumbersome for the complex INSERT & SELECTcode. I'm looking for a simpler way.Simplified down, I am looking for something like this . . .CREATE PROCEDURE dbo.TestInsert ASCREATE TABLE tblTest(tstID DATETIME)INSERT INTO tblTest(tstID) VALUES(GETDATE())GOCREATE PROCEDURE dbo.TestSelect ASSELECT * FROM tblTestDROP TABLE tblTestIn the above example, if the SPs are owned by dbo (as above), CREATETABLE & DROP TABLE use MyUser.tblTest while INSERT & SELECT usedbo.tblTest.If the SPs are owned by the user (eg MyUser.TestInsert), it workscorrectly (MyUser.tblTest is used throughout) but I would have to havea pair of SPs for each user.* I have MS Access ADP front end linked to a SQL Server database. Forreports with complex datasets, it times out. Therefore it suit mypurposes to create a temporary table first and then to open the reportbased on that temporary table.

View 6 Replies View Related

What Is The Difference Between: A Table Create Using Table Variable And Using # Temporary Table In Stored Procedure

Aug 29, 2007

which is more efficient...which takes less memory...how is the memory allocation done for both the types.

View 1 Replies View Related

How To Create Random Text By Query Analyzer

Oct 5, 2006

use AFMIF EXISTS (SELECT * FROM sysobjects WHERE type = 'U' AND name='uye_idler') drop table uye_idlerCREATE TABLE uye_idler ( uye_no int NOT NULL, ) GO DECLARE @uye_numarası int Set @uye_numarası = 1 WHILE @uye_numarası < 15001     BEGIN         INSERT INTO uye_idler VALUES (@uye_numarası)            Set @uye_numarası = @uye_numarası + 1     EndHi , I am able to create 15000 records by the codes above .By the same way I want to create random texts as ASD ,WER,SAD,DFG etc. How can I do this ? Thanks ...

View 1 Replies View Related

Create A Text File From W/in A Stored Procedure

Sep 7, 1999

Is there a way to use BCP or something else within a stored procedure to extract data from a select statement out to a text file?

View 4 Replies View Related

Stored Procedure That Create A Text File

Aug 7, 1998

Hi!!!

Is it possible to create a stored procedure which will create a text file (containing information from some tables) and send it via e-mail to a list of user.

I know that I will have to configure the SQL Mail.

If it is possible, can someone give me sample code.

Thanks you.

View 1 Replies View Related

How To Create DB For Single Attribute Having More Than 2 Text Fields

Dec 14, 2014

How can we create a DB for a single attribute such as ORDER DETAILS, CASH RECEIPT, TAX INVOICE having more than 2 text fields.

Also, in every form attribute such as order id is not present - in order identify the same as a primay key. So, which other attributes or fields can be considered as a primary key.

View 5 Replies View Related

Unable To Create Full Text Catalog! Please Help

Dec 10, 2007

Hi,

Hope this is the right forum - apologies if its not. I'm a newbie. I'm at my wits end as I cant create a full-text catalog in SQL server 2000. Let me explain (I'll try and include as much info as I can):-

When I run the following command:
sp_fulltext_catalog 'Cat_Desc', 'create'

I get the following error mesaage:

Server: Msg 7619, Level 16, State 2, Procedure sp_fulltext_catalog, Line 64
The specified object cannot be found. Specify the name of an existing object.

I in as user sa. I determine this from running:
select suser_sname()

The SQL Server instance is running under user: LocalSystem
I determine this from the following command:

DECLARE @serviceaccount varchar(100)
EXECUTE master.dbo.xp_instance_regread
N'HKEY_LOCAL_MACHINE',
N'SYSTEMCurrentControlSetServicesMSSQLSERVER',
N'ObjectName',
@ServiceAccount OUTPUT,
N'no_output'
SELECT @Serviceaccount

The database is owned by: sa (determined by visual inspection).

Yes, full text indexing is enabled for this database as I ran the following command:

EXEC sp_fulltext_database 'enable'

and get the following:
(1 row(s) affected)
(0 row(s) affected)
(1 row(s) affected)



Now I can't think of anything else. I'm at my wits end! Please help. Any comments/suggestions/ideas/diagnostics greatly appreciated.

Thank you,
Al.

PS: Apologies if I'm in the wrong forum!

View 19 Replies View Related

Dynamically Create Text File As Destination

Feb 16, 2007

I am trying to create a text file from an SQL query on a SQL table. I would like the SSIS package to prompt for the file name and path. The text file is tab delimited and the text qualifier is a double quote.

Thanks,

Fred

View 9 Replies View Related

Can Not Create A Full Text Catalog Or Index

Nov 2, 2007

When I try to create a full-text catalog on my local database I get an error that I can not find support information for.

Here is the command I run :CREATE FULLTEXT CATALOG asset_search_values_catalog on FILEGROUP ftFileGroup IN PATH 'C:Program FilesMicrosoft SQL ServerMSSQL.1MSSQLData' as default

Here is the error message I get:
Msg 7689, Level 16, State 1, Line 1
Execution of a full-text operation failed. 'No such interface supported'


I check the properties of my database and Full-text is enabled.

I am running SQL Server 2005, on an XP Pro, SP2.
I had originially installed in side by side with SQL Server 2000.

I even tried uninstalling SQL Server 2005 (to try a re-install), I could not even uninstall the database.

What should I do.

View 1 Replies View Related

Cmdsql - Create A Text File Without Informational Messages

May 2, 2007

Hello all
I have a sql file that I want execute by using the cmdsql command line. But when I create a text file I receive two Informational Messages:
1. "Changed database context to 'DataBaseName'."
2. (2 row(s) affected)
How can I ignore these messages in my text file? there is a parametter or something elese to configure to avoir these Informational Messages?
 

View 1 Replies View Related

Create Rich Text From A Select And Save It In A Field

Jun 28, 2007

Hi,
I want to execute some queries inside a stored procedure, get the data and create from them some strings with formatted parts (bold, italic, underline, different color fonts) and save them in a text field. These strings are going to be displayed in some DBRichText control in a database application built with Delphi. Is there an easy way to create these complex rtf formats in MSSQL
or some ideas regarding this problem?

Best Regards,
Manolis Perrakis

View 1 Replies View Related

How To Create Full Text Index By SQL Server Express??

Apr 14, 2007

Hi all..

I tried too much to create FULL TEXT INDEX by using SQL Server 2005 Management Studio Express, it returns this ERR MSG:

Informational: No full-text supported languages found.
Informational: No full-text supported languages found.
Msg 7680, Level 16, State 1, Line 1
Default full-text index language is not a language supported by full-text search

This problem dos not come when I use Microsoft SQL Server 2005 Management Studio, to create FULL TEXT INDEX!

My DB collation is: "Arabic_CI_AS"
But I don€™t need this, I can use English Language.

Please, what can I do?

View 4 Replies View Related

Power Pivot :: Pivot Table Loses Text Wrapping For Text Data Upon Refresh

Apr 29, 2015

I have a pivot table that connects to our data warehouse via a PowerPivot connection.  The data contains a bunch of comment fields that are each between 250 and 500 characters.  I've set the columns in this pivot table to have the 'Wrap Text' set to true so that the user experience is better, and they can view these comment fields more clearly.

However, whenever I refresh the data, the text wrapping un-sets itself.  Interestingly, the 'Wrap Text' setting is still enabled, but I have to go and click it, then click it again to actually wrap the text.  This is very burdensome on the user, and degrading the experience.

Any way to make this text wrapping stick so that I don't have to re-set it every time I refresh the data?

View 2 Replies View Related

Dynamically Create Text File As Destination From Sql Script In SSIS

Mar 27, 2007



I have a select Script as follows:



SELECT c.ABC AS 'ABC'

, a.Qty AS 'Quantity_Recived'

, b.PC AS 'PC'

, b.PC AS 'PC'

, 'I' AS 'Flag'

FROM TNRInventory.dbo.tInventoryAlloc AS a

LEFT OUTER JOIN vwInventoryAllocMapping AS vwMap ON a.TNRAllocTypeID = vwMap.TNRInventoryAllocID

LEFT OUTER JOIN ABC.dbo.ZREFRESHTAB AS b ON a.DispenserID = b.Asset

LEFT OUTER JOIN ABC.dbo.TableJoinKey AS c ON a.TitleID = c.TITLE_ID

WHERE (vwMap.DataSourceID = 3) and vwMap.[DataSourceAllocName] = 'I'

group by c.SKU_NO , vwMap.[DataSourceAllocName],a.Qty , b.Profit_Center

order by c.SKU_NO,vwMap.[DataSourceAllocName]

GO



i have to send the result of aforesaid script in batch of 300 records per file (tab delimited text file)
now the file name must be dynamically created as each file will contain 300 records.



I have found some document related to same issue on this url

http://forums.microsoft.com/TechNet/ShowPost.aspx?PostID=1238184&SiteID=17

but still there is a catch.



Can any one guide/suggest me better way to do the aforesaid.



Thanks

View 8 Replies View Related







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