Showing posts with label guys. Show all posts
Showing posts with label guys. Show all posts

Friday, March 30, 2012

Import Prs

Hey guys,

I was curious how other people create several 100 SQL objects on a
new database. Example: I have each procedure in its own text file (IE
100 .sql files), so I just check them out of source control, then run
a perl script that just dumps them into one txt file. Then I paste
that mess into Query Analyzer.

So to reiterate my question, how do other people get sql objects
into a database. Obviously I'd do an object copy if they resided in
some other database.

While my solution works, there is always a better way. Thanks for
your suggestions.

- CptI don't know Perl but I assume you could execute OSQL from your script.
Another method is to invoke a Windows FOR command in a command prompt
window to execute OSQL. For example:

CD C:\SQLScripts
FOR %v in (*.sql) DO OSQL -i "%v" -o "%v.out" -E

--
Hope this helps.

Dan Guzman
SQL Server MVP

--------
SQL FAQ links (courtesy Neil Pike):

http://www.ntfaq.com/Articles/Index...epartmentID=800
http://www.sqlserverfaq.com
http://www.mssqlserver.com/faq
--------

"CptVorpal" <cptvorpal@.hotmail.com> wrote in message
news:76cffbe0.0310081530.6c7a034b@.posting.google.c om...
> Hey guys,
> I was curious how other people create several 100 SQL objects on a
> new database. Example: I have each procedure in its own text file (IE
> 100 .sql files), so I just check them out of source control, then run
> a perl script that just dumps them into one txt file. Then I paste
> that mess into Query Analyzer.
> So to reiterate my question, how do other people get sql objects
> into a database. Obviously I'd do an object copy if they resided in
> some other database.
> While my solution works, there is always a better way. Thanks for
> your suggestions.
> - Cpt|||cptvorpal@.hotmail.com (CptVorpal) wrote in message news:<76cffbe0.0310081530.6c7a034b@.posting.google.com>...
> Hey guys,
> I was curious how other people create several 100 SQL objects on a
> new database. Example: I have each procedure in its own text file (IE
> 100 .sql files), so I just check them out of source control, then run
> a perl script that just dumps them into one txt file. Then I paste
> that mess into Query Analyzer.
> So to reiterate my question, how do other people get sql objects
> into a database. Obviously I'd do an object copy if they resided in
> some other database.
> While my solution works, there is always a better way. Thanks for
> your suggestions.
> - Cpt

You could start by looking at using OSQL.EXE to run your .sql scripts
from the command line - it should be straightforward to wrap that in a
script of some sort which gets the list of scripts, then executes them
one by one. You can trap the output from OSQL and use it for error
handling as well.

Simon|||[posted and mailed]

CptVorpal (cptvorpal@.hotmail.com) writes:
> I was curious how other people create several 100 SQL objects on a
> new database. Example: I have each procedure in its own text file (IE
> 100 .sql files), so I just check them out of source control, then run
> a perl script that just dumps them into one txt file. Then I paste
> that mess into Query Analyzer.
> So to reiterate my question, how do other people get sql objects
> into a database. Obviously I'd do an object copy if they resided in
> some other database.
> While my solution works, there is always a better way. Thanks for
> your suggestions.

The suggestion from Dan and Simon to use OSQL is a good one. I'll
add that you can invoke OSQL for each file. This could be help to
track any errors.

For a faster execution you could look into to connect to the database
from Perl using some interface. (There is a short overview on my
web site at: http://www.algonet.se/~sommar/mssql...ternatives.html.

And if you want a ton of bells and whistles, you can look at
http://www.abaris.se/abaperls/. This is the load tool that we use
in our shop, and as the name indicates it's all Perl. You could
say that I started where you are now, and this is what I have seven
years later. :-)

--
Erland Sommarskog, SQL Server MVP, sommar@.algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.aspsql

Monday, March 26, 2012

import html string into sql database

Hi guys,

Here is the html string that I want to transfer it to another variable so, I can post it to my sql server database

<span style=\""font: 12px arial; color : #000000; text-decoration : none;\""><br>MODEL- USB01000C01CL VENDOR- ACTIONTEC ELECTRONICS<br> <br>FEATURES- VoSKY Chatterbox for Skype<br> Plug-and-Play Speakerphone for Skype!<br> VoSKY Chatterbox from Actiontec is the go-anywhere speakerphone <br> solution for Skype! No software or special drivers required. Simply <br> plug your VoSKY Chatterbox into any computer and you are ready to <br> start talking! <br> Make Skype Calls on a Speakerphone Plug Chatterbox into your <br> computer, and make or receive a Skype call as you normally would. <br> Then talk to your Skype contacts, hands-free and without wearing <br> headsets! <br> You do not need to download any additional drivers or software. Just<br> take Chatterbox, plug it into any computer, and you are ready to <br> go! <br> Chatterbox offers superb sound quality with the latest technology in<br> full duplex audio, DSP-enhanced sound quality, and echo <br> cancellation. <br>* Verified by and certified for Skype <br>* Replaces your headset/microphone <br>* Small, lightweight device goes anywhere you go <br>* Full duplex speakerphone with adjustable volume and mute control <br>* DSP-enhanced sound quality <br> <br> -- SPECIFICATIONs -----------<br>CONNECTORs - (1) USB 2.0/1.1 port<br> (1) 2.5mm Headset Jack<br>INDICATORS - LEDs for Ready, Microphone Mute<br>FUNCTION KEYS- Volume Up, Volume Down, Microphone Mute <br>SPEAKER - 1w peak, 40 mm, 4 ohm, 120 Hz to 6 KHz, 120 dB <br>MICROPHONE - Voice pick-up range up to 4 meters <br>APPROVALS - FCC, CE<br>REQUIREMENTS - PC running Windows 2000/XP with one available USB port. <br>DIMENSIONS - 7.7cm x 5.8cm x 2.1cm WT. 50 grams<br> <br><br>MANUFACTURER WARRANTY: 1 YEAR</span>

however If I just do;

dim myvariable as string = htmlvalueatabove

after importing the myvariable value to the sqlserver my asp.net detailview control only able to show only first 17 letters . Up until "fo"

I am sorry if I am not able to provide you clear question. I am so frastrated at the moment, after 6 coffie and 2 minutes bathroom break I can't write anymore. I will shutup and wait for one you and respond.

thanks

Cemal

SQL Server treats an single quote ' as a delimiter character so to properly store it in the database you have to use double quotes ''

|||

Thank you very much for trying to answer my question, Even though you might be correct on your answer for another user problem, in my case this was another story. I simply forget and defined the sql variable as 255 character lenght. All I had do was; go back to my sql stored procudure and change the limited character varibale to text.

afterwards everything worked out fine.

again thank you.

Monday, March 12, 2012

Import data into SQL Server

Hi guys,

I am looking to import data into the SQL Server database, from a CSV file..

anyone with any suggestions for how to start with it ??

Thanks heapsUse DTS.Here is a link to a Google groups listing, which also mentione using BPC.|||Thanks a lot mate... ur a gem|||Just one problem...

How do i call that DTS Saved job ?|||Is this a one-time job or something that needs to be run regularly? If a one time, just select the job in Enterprise Manager and I believe if you right click on it you will be able to run it (not near EM just now for details).

import data from excel to MS SQL using DTS

Hi guys,
I need to import data from excel to MS SQL table, but I already have data in MS SQL table, I just want to update one column.
How can I do that?There are a zillion (or is that a squintillion Rudy?) ways to do this, but I'd suggest bringing the Excel worksheet into a scratch table, then doing an update of the column in the target table, with lots of error checking added for good measure.

-PatP

Wednesday, March 7, 2012

import csv file to sql

Hi guys

i am trying to import a csv file into the sql, but my problem is that I have a message in one of the columns. suggestions

- Executing (Error)

Messages

Error 0xc02020a1: Data Flow Task: Data conversion failed. The data conversion for column "INTVAL" returned status value 2 and status text "The value could not be converted because of a potential loss of data.".
(SQL Server Import and Export Wizard)

Error 0xc0209029: Data Flow Task: The "output column "INTVAL" (22)" failed because error code 0xC0209084 occurred, and the error row disposition on "output column "INTVAL" (22)" specifies failure on error. An error occurred on the specified object of the specified component.
(SQL Server Import and Export Wizard)

Error 0xc0202092: Data Flow Task: An error occurred while processing file "E:\minessight\blastinfoattrib.csv" on data row 2.
(SQL Server Import and Export Wizard)

Error 0xc0047038: Data Flow Task: The PrimeOutput method on component "Source - blastinfoattrib_csv" (1) returned error code 0xC0202092. The component returned a failure code when the pipeline engine called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing.
(SQL Server Import and Export Wizard)

Error 0xc0047021: Data Flow Task: Thread "SourceThread0" has exited with error code 0xC0047038.
(SQL Server Import and Export Wizard)

Error 0xc0047039: Data Flow Task: Thread "WorkThread0" received a shutdown signal and is terminating. The user requested a shutdown, or an error in another thread is causing the pipeline to shutdown.
(SQL Server Import and Export Wizard)

Error 0xc0047021: Data Flow Task: Thread "WorkThread0" has exited with error code 0xC0047039.
(SQL Server Import and Export Wizard)

It appears that the data that was to be imported into the IntVal column is too big for the datatype of the column.

If you were to post the table DDL, we may be able to provide better help.

|||

Hi,

The script which has the DDL is as shown below;

Code Snippet

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[GEOMSEGMENTVFD]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[GEOMSEGMENTVFD]
GO
CREATE TABLE [dbo].[GEOMSEGMENTVFD] (
[OBJECTID] [varchar] (50) NOT NULL ,
[SEGMENTID] [varchar] (50) NOT NULL ,
[VFNAME] [varchar] (50) NOT NULL ,
[TEXTVAL] [varchar] (50) NULL ,
[INTVAL] [int] NULL ,
[DBLVAL] [float] NULL ,
[BLBVAL] [image] NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
ALTER TABLE [dbo].[GEOMSEGMENTVFD] WITH NOCHECK ADD
CONSTRAINT [PRIMARYKEYGEOMSEGMENTVFD] PRIMARY KEY CLUSTERED
(
[OBJECTID],
[SEGMENTID],
[VFNAME]
) WITH FILLFACTOR = 90 ON [PRIMARY]
GO
ALTER TABLE [dbo].[GEOMSEGMENTVFD] WITH NOCHECK ADD
CONSTRAINT FK_GEOMSEGMENTVFD_GEOMSEGMENT
FOREIGN KEY (OBJECTID,SEGMENTID)
REFERENCES [dbo].[GEOMSEGMENT] (OBJECTID,SEGMENTID)
ON DELETE CASCADE
ON UPDATE CASCADE

GO
ALTER TABLE [dbo].[GEOMSEGMENTVFD] WITH NOCHECK ADD
CONSTRAINT FK_GEOMSEGMENTVFD_GEOMVF
FOREIGN KEY (VFNAME)
REFERENCES [dbo].[GEOMVF] (VFNAME)
ON DELETE CASCADE
ON UPDATE CASCADE

GO

Thanks

|||

The next task is to verify that in the import data (csv file), the values to be transferred to the IntVal column are NOT outside the range of:

-2,147,483,648 through 2,147,483,647

If you find data that falls outside that range, you will have to either: correct the import data to be within that range, OR, change the IntVal datatype in the table to be a [bigint] datatype.

Import csv file to MS SQL 2005

Hi Guys,

I have been trying to search for a free asp or asp.net script that will allow me to upload a .csv file and import it into an MS SQL Database. As its going to be a ProductCatalog and pricing changes nearly 2nd day. And wanting to an a script that I can put in my admin panel on my site to upload a .csv file and import it to a MS SQL Database.

I will be updating fields as well as adding new products. So the upload script would need to be able to handle those two things.

Is their any good free scripts around that people can recommend.

Thanks

Matthew

Which version of SQL server are you using?

SQL Server Integration Services will do this nicely...

|||

Using SQL 2005 Standard Edition, as the database will be used on a Website, don't want to have to keep logging into the control panel and then going and using the Web-Based SQL Management Tools.

Matthew

|||

Hello,

http://www.nigelrivett.net/ImportTextFiles.html is a script to import text files that arrive in a directory into a table.

It will process every file in the directory with the correct filemask and move the file to an archive directory on completion.
It can be used in conjunction with an ftpget SP to import files from a ftp server .

You could add some minor change to import csv file.

import and export data

hi guys,
cd you just help me to export and import data from sqlserver2000 to msaccess.Go to SQL Server Enterprise Manager.

Go to Tools - Data Transformation Services and follow a wizard.|||thank you iburyak