473,800 Members | 2,833 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

java and mssql

2 New Member
How to run following mssql file using jdbc?

PRINT ''
PRINT '############## ############### ############### ############### #######'
PRINT 'Begin Script: DropTables ' + convert(varchar ,current_timest amp)
PRINT ' DB server: ' + @@servername
PRINT ''

BEGIN

DECLARE @user_table VARCHAR(80)


DECLARE
drop_tables CURSOR FOR
SELECT name
FROM sysobjects
WHERE xtype='U' and name not like 'cmi%' and name<>'ERR_CLK' and name<>'TMP_CLK'
ORDER BY name --user table

PRINT ' Checking for any views before dropping tables.'

SELECT s2.name
FROM sysobjects s2, syscomments s1
WHERE (s1.id=s2.id) AND (s2.xtype ='V')
AND (s2.name NOT LIKE 'sys%')
ORDER BY s2.name

IF (@@ROWCOUNT > 0) BEGIN
PRINT ''
PRINT ' ############### ############### ############### ############### ############### ###########'
PRINT ' ### WARNING -> You must drop all user defined views before dropping tables. ###'
PRINT ' ### Tables will not be dropped. ###'
PRINT ' ############### ############### ############### ############### ############### ###########'
PRINT ''

END
ELSE BEGIN

PRINT ''
PRINT 'No Views found, OK to drop tables.'
PRINT ''

OPEN drop_tables
FETCH NEXT FROM drop_tables INTO @user_table

WHILE(@@FETCH_S TATUS=0) BEGIN
PRINT (' ##<INFO>## DROP TABLE ' + @user_table)
EXEC ('DROP TABLE ' + @user_table)
FETCH NEXT FROM drop_tables INTO @user_table
END

CLOSE drop_tables
DEALLOCATE drop_tables
PRINT ''
END

END

PRINT ''
PRINT 'End Script: DropTables ' + convert(varchar ,current_timest amp)
PRINT '############## ############### ############### ############### #######'

GO
Jul 10 '07 #1
1 1990
r035198x
13,262 MVP
How to run following mssql file using jdbc?

PRINT ''
PRINT '############## ############### ############### ############### #######'
PRINT 'Begin Script: DropTables ' + convert(varchar ,current_timest amp)
PRINT ' DB server: ' + @@servername
PRINT ''

BEGIN

DECLARE @user_table VARCHAR(80)


DECLARE
drop_tables CURSOR FOR
SELECT name
FROM sysobjects
WHERE xtype='U' and name not like 'cmi%' and name<>'ERR_CLK' and name<>'TMP_CLK'
ORDER BY name --user table

PRINT ' Checking for any views before dropping tables.'

SELECT s2.name
FROM sysobjects s2, syscomments s1
WHERE (s1.id=s2.id) AND (s2.xtype ='V')
AND (s2.name NOT LIKE 'sys%')
ORDER BY s2.name

IF (@@ROWCOUNT > 0) BEGIN
PRINT ''
PRINT ' ############### ############### ############### ############### ############### ###########'
PRINT ' ### WARNING -> You must drop all user defined views before dropping tables. ###'
PRINT ' ### Tables will not be dropped. ###'
PRINT ' ############### ############### ############### ############### ############### ###########'
PRINT ''

END
ELSE BEGIN

PRINT ''
PRINT 'No Views found, OK to drop tables.'
PRINT ''

OPEN drop_tables
FETCH NEXT FROM drop_tables INTO @user_table

WHILE(@@FETCH_S TATUS=0) BEGIN
PRINT (' ##<INFO>## DROP TABLE ' + @user_table)
EXEC ('DROP TABLE ' + @user_table)
FETCH NEXT FROM drop_tables INTO @user_table
END

CLOSE drop_tables
DEALLOCATE drop_tables
PRINT ''
END

END

PRINT ''
PRINT 'End Script: DropTables ' + convert(varchar ,current_timest amp)
PRINT '############## ############### ############### ############### #######'

GO
You'll want to read the JDBC totuoral.
Jul 10 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

11
4398
by: badz | last post by:
Hi frenz Lately I try to use MSSQL and PHP , the problem arise when PHP try to read MSSQL field with 'image' data type, header("Content-type: image/jpeg"); // act as a jpg file to browser I try to used normal working file that store BLOB as file type in MSSQL ...but still not working. Is it because the image data type in MSSQL can not be recognise by PHP?
7
23877
by: mj | last post by:
Hello, thanks for the help. I am running a WinXP Pro w/ SP2 (my home computer, with ZoneAlarm firewall) Apache 2.0.52 MySQL 4.1.7 PHP 5.1.0-dev I have developed a PHP/MySQL web app that tracks jobs for me, and we
3
6015
by: Robert Bralic | last post by:
Hello, I writed small graphical editor for probabilystic networks in JAVA, but there was problem with making save file inJAVA. I thinked about it and I concluded that Save in JAVA is great error. If is possibile to mke save in JAVA then is posible tha make save in any
4
1847
by: Don Grover | last post by:
I hope some one can help, I have a html table that is created with asp that has a row of repeated buttons down the side. these call a page passing a query string with invoice number. I need to get a Java Yes/No dialog up and on yes call the hyperling query string. I can do this with a single hyperlink but not passing on the query string and invnumber Here is my Response Write link
14
2474
by: Kukurydz | last post by:
I've got such problem: My database is stored on MSSQL Server. I have to write reports for it in MSAccess. I've got a problem with creating a query which will select records from MSSQL table with date and time values from given range. The difficulty is mainly caused by the fact, that Date and Time is stored in separate rows as String . I've tried to use CDate() function in my query, but it worked well only during tests on small table (about...
1
3087
by: sangig | last post by:
hi forum, can any body help me out with the Java equivalent data type for MSSQL IMAGE data type? Thanks Sangig
0
1449
by: Derftics | last post by:
Hi Guys, Is there anyone who have tried installing MSSQL 2000 and MSSQL 2005 servers in one desktop computer? I have tried using MSDE and successfully install the MSSQL 2000 server but when I tried installing MSSQL 2005, it allows only the client tools. I have revert the process and successfully install MSSQL 2005 server but now the MSDE was prompting me an error. Is possible to install both versions of MSSQL servers in one desktop...
0
1025
by: ttamilvanan81 | last post by:
Hai everyone, I am Junior level Developer for java. I need to Export the Foxpro dump file into MSSQL using Java source code within the J2EE Application at Run time. Can anyone know this, kindly post me, Thanks Tamilvanan
14
2934
by: guswebb | last post by:
Hi. I'm a newbie to PHP and am having a few problems as follows... I have installed PHP successfully on server 1 which is running IIS 6 (W2k3) and hosting multiple sites, some of which connect to MSSQL 2k (SP4) on server 2 (using ASP). I can load a basic 'Hellow world' PHP page hosted on server1 but when I add the code to create a simple connection to MSSQL on server 2, my PHP doesn't seem to connect nor output any of the desired query...
0
9550
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10501
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10273
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10032
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7574
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5469
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4149
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2944
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.