0

Not quite sure what these are to be honest. I am looking at someone else's SQL query and they have SELECT statements which look like this:

SELECT 
    Something,
    Something
FROM
MyTable(DEFAULT, DEFAULT, DEFAULT)

And Another which looks like this:

SELECT 
    Something,
    Something
FROM
MyTable(NULL)

Christ, when I do a SELECT statement, I only put the table name there and that's it.

Could someone please tell me what the (DEFAULT, DEFAULT, DEFAULT) would be used for? and also the (NULL) - I'm sure there are many more of these once I know what they are.

My apologies if this is a duplicate question, but I couldn't seem to find an answer anywhere.

Thanks! Mike

Fizor
  • 1,480
  • 1
  • 16
  • 31
  • 1
    Are you sure that is a table, it could be a function(?) – SAS Mar 04 '15 at 13:26
  • MyTable isn't a table, it's a table function requiring 3 parameters in the former statement and 1 in the second. – MWillemse Mar 04 '15 at 13:27
  • Also thought it was a function, but cant seem to find the function they are calling. So I assumed table as there was a table with the same name. – Fizor Mar 04 '15 at 13:27
  • you are both probably 100% correct, I'm going to dig for this function I cant seem to find :) Thank you though! Thought I was losing my mind. – Fizor Mar 04 '15 at 13:29
  • possible duplicate of [T-SQL - function with default parameters](http://stackoverflow.com/questions/8358315/t-sql-function-with-default-parameters) – CodeCaster Mar 04 '15 at 13:31

2 Answers2

1

It appears that MyTable(DEFAULT, DEFAULT, DEFAULT) is a table-valued function call. This function has three parameters, and all these parameters should take default values.

Alsin
  • 1,514
  • 1
  • 14
  • 18
  • Was indeed a function, Wasn't on the DB I was looking at because they are using `Synonyms` Thanks mate. – Fizor Mar 04 '15 at 14:31
0

In Management Studio, Look under Programmability->Functions->Table-valued Functions. There you will see the definition of the function.

SAS
  • 3,943
  • 2
  • 27
  • 48
  • What question does this answer? – CodeCaster Mar 04 '15 at 13:29
  • The definition of the function will explain the function definition and show what the arguments are for. – SAS Mar 04 '15 at 13:31
  • Why the downvote? The information is meant to help the asker to find the source code and explain the call! – SAS Mar 06 '15 at 08:54
  • I am just trying to help.. It shows where to find the definition of the function used, and thus explains what the DEFAULT-values are and what they are used for, which is exactly what is asked.. imho.. – SAS Mar 06 '15 at 12:06
  • _"It shows where to find the definition of the function used"_ - yeah, and _just that_. OP didn't even know it was a function call. The question is not _"How can I see a list of table-valued functions in my database"_. – CodeCaster Mar 06 '15 at 12:12
  • What is wrong with informing, by showing where to find the actual function call so he can see for himself what the parameters are used for, instead of just giving a general statement like 'it is a function call' (which I also did in a comment..) – SAS Mar 06 '15 at 12:23
  • Compare your answer to the accepted answer. Answers should be self-contained. Your answer does not explain anything. – CodeCaster Mar 06 '15 at 12:25
  • Well, sorry, but I disagree. Moving on. – SAS Mar 06 '15 at 12:35