Question: I want to save a video file in C:\ by incrementing the file name e.g. video001.avi video002.avi video003.avi etc. i want to do this in java. The program is on 

[Problem in java programming on windows7 (working well in windows xp)](https://stackoverflow.com/questions/2298101/problem-in-java-programing-on-windows7working-well-in-windows-xp)

How do i increment the file name so that it saves without replacing the older file.

Answer: 
you should make a query string and then run it by `exec()` function.

getting server name :

```
SELECT @@SERVERNAME

```

getting current db name :

```
SELECT DB_NAME() AS DataBaseName

```
You do not have to use `EXEC` you could use something like `select * from openquery(MyLinkedServer,@sql)` THough i prefer `EXEC(@sql) AT MyLinkedServer`

But all work