Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7804535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T01:56:46+00:00 2026-06-02T01:56:46+00:00

I am using perforce. Some helpful members of the stackoverflow community helped me find

  • 0

I am using perforce. Some helpful members of the stackoverflow community helped me find the p4reports program that sets up an ODBC data source to access our perforce data. I created a query that returns exactly the information i need … almost.

Here is the query:

SELECT a.file, a.time, a.action, a.revision, a.change, b.description
FROM files a, changes b
WHERE a.change = b.change AND ((b.p4options='longdesc'));

The problem is that the a.file column returns the name of the file with the whole path, like this:

//depot/folder_1/folder_2/.../file_name.txt

I would like this column to just contain the file name, like this:

file_name.txt

Does anyone know an SQL query that could do this? Now matter how deeply nested a file is in a folder structure?

Here is a link to the perforce SQL report functions. Some basic string functions but I am having a hard time putting together how I can always return the right text with these functions.

http://www.perforce.com/perforce/doc.current/manuals/p4report/ab_functions.html#1045728

In MySQL I would do something like this:

SELECT right(a.file,locate("/",reverse(a.file))-1), a.time, a.action, a.revision, a.change, b.description
FROM files a, changes b
WHERE a.change = b.change AND ((b.p4options='longdesc'));

And it would work, but there is no reverse function in the perforce SQL as far as I can tell. Any help would be greatly appreciated!

Thanks!!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T01:56:47+00:00Added an answer on June 2, 2026 at 1:56 am

    You might want to take a look at P4toDB, which will replicate Perforce data into a regular database. That way you can run more advanced SQL queries or even use a report engine.

    http://kb.perforce.com/article/1172/p4todb-readme

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Perforce, if that changes the tune of the answers at all. I'd
I want to modify an existing Perforce label using a script that I can
We're using Perforce and Visual Studio. Whenever we create a branch, some projects will
I am creating some build scripts that interact with Perforce and I would like
I have some trouble getting the VCS of teamcity work. I'm using perforce and
we are using Perforce for source configuration management and I have just started to
I have VS 2010 with extension VS2P4 for using Perforce commands within Visual Studio.
Is it possible to mount a local directory into another one? Using Perforce, I
Using Nunit, I want to be able to write a test fixture that will
Using PHP, I can convert MySQL data or static table data to csv, Excel,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.